apache / apache/maven-archetype

[ARCHETYPE-588] archetype:create-from-project propertyFile defaults project values

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

Description

**[Nicolas Dywicki](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ndywicki)** opened **[ARCHETYPE-588](https://issues.apache.org/jira/browse/ARCHETYPE-588?redirect=false)** and commented

Hi team,

 

I want to create a multi-module archetype maven project from an existing project.Everything works fine, and I use the **_propertyFile_** to customize some elements.

I want to use the [Maven CI Friendly Versions|https://maven.apache.org/maven-ci-friendly.html]  (via **${revision}**) but it is automatically replaced when the archetype is generated.

So I want to force the default version to **${revision}** in the **_propertyFile_** but it is not taken into account in the target generated archetype project even if I set a regular version number like version=2.0

 

artifact.properties:

```java
archetype.filteredExtensions=java,yml,json,md,js,properties,xml,html,webapp
archetype.filteredFileNames=jenkinsfile
excludePatterns=archetype.properties,BUILD.md,**/.git/**,**/.idea/**,**/*.iml,**/node*/**,**/target/**
gitignore=.gitignore
gitattributes=.gitattributes
version=2.0
```

 

Generate:

```java
mvnw clean archetype:create-from-project -Darchetype.properties=archetype.properties
```

 

Target **archetype-metada.xml** does not contain version property:

```java


.gitignore


.gitattributes

```

 

Then when I deploy and generate new app, I have to enter the version.

A workaround is to use **-Dversion=${revision}** parameter:

```java
mvn archetype:generate -DarchetypeGroupId=com.demo -DarchetypeArtifactId=demo-archetype -DgroupId=com.demo -DartifactId=demo -Dversion=${revision}
```

 

Do you know why the property version is not taken into account as explained in the [documentation|#propertyFile]]?

 

Thanks,

Nicolas

 

 

 

 

---

**Affects:** 3.1.2

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the stated `mvnw clean archetype:create-from-project -Darchetype.properties=archetype.properties` command and inspect the generated `archetype-metadata.xml`. Compare the propertyFile's `version=2.0` with the generated required properties; done means the version default is preserved in the metadata and no longer must be entered during archetype generation.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.