Uploaded image for project: 'Maven Archetype'
  1. Maven Archetype
  2. ARCHETYPE-588

archetype:create-from-project propertyFile defaults project values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.1.2
    • None
    • Generator
    • None

    Description

      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:

      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:

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

       

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

      <requiredProperties>
        <requiredProperty key="gitignore">
          <defaultValue>.gitignore</defaultValue>
        </requiredProperty>
        <requiredProperty key="gitattributes">
          <defaultValue>.gitattributes</defaultValue>
        </requiredProperty>
      </requiredProperties>
      

       

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

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

      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]?

       

      Thanks,

      Nicolas

       

       

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ndywicki Nicolas Dywicki
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: