apache / apache/maven-archetype

[ARCHETYPE-490] Required property default value incorrect when using system property

Open
#761 1 comment 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
148
Forks
181
Avg merge
1d 20h
Merged PRs (30d)
8

Description

**[Christopher Rowland](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=dfsf5263)** opened **[ARCHETYPE-490](https://issues.apache.org/jira/browse/ARCHETYPE-490?redirect=false)** and commented

When performing a generation while passing in artifactId, groupId, or version as a system property, required property default values using velocity expressions are evaluated incorrectly.

As an example, I have an archetype with groupId com.apache and artifactId automation-archetype. If I attempt to generate using the following command:

mvn archetype:generate -DarchetypeGroupId=com.apache -DarchetypeArtifactId=automation-archetype -DartifactId=hello-world-automation

And I have a required property defined as:

```xml

${artifactId.replace("-", "_")}

```

Then the resulting property is evaluated to automation_archetype instead of hello_world_automation.

This changed from version 2.2 to 2.3 by a patch introduced in ARCHETYPE-397.

Proposed additional patch is attached.

---

**Affects:** 2.3, 2.4

**Attachments:**
- [ARCHETYPE-490.patch](https://issues.apache.org/jira/secure/attachment/12764058/ARCHETYPE-490.patch) (_1.39 kB_)

**Issue Links:**
- [ARCHETYPE-397](https://issues.apache.org/jira/browse/ARCHETYPE-397) Required property default value is not displayed correctly if a Velocity expression

- [ARCHETYPE-556](https://issues.apache.org/jira/browse/ARCHETYPE-556) Property in default-value is not replaced when using automated mode

3 votes, 4 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the supplied mvn archetype:generate command and requiredProperty definition, then compare the behavior with versions 2.2 and 2.3. Read ARCHETYPE-397 and ARCHETYPE-556 and review the attached ARCHETYPE-490.patch; done means the default uses the supplied artifactId and evaluates to hello_world_automation.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.