Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: backlog
    • Fix Version/s: 3.0.0
    • Component/s: Plugin
    • Labels:
      None

      Description

      Same issue as https://issues.apache.org/jira/browse/ARCHETYPE-318.

      If I specify a required property and then use that in another required property, as follows:

      	<requiredProperties>
      		<requiredProperty key="groupName">
      		</requiredProperty>
      		<requiredProperty key="serviceName">
      		</requiredProperty>
      		<requiredProperty key="groupId">
      			<defaultValue>com.example.${groupName}</defaultValue>
      		</requiredProperty>
      		<requiredProperty key="package">
      			<defaultValue>com.example.${groupName}</defaultValue>
      		</requiredProperty>
      		<requiredProperty key="artifactId">
      			<defaultValue>${serviceName}</defaultValue>
      		</requiredProperty>
      		<requiredProperty key="version">
      			<defaultValue>1.0.0-SNAPSHOT</defaultValue>
      		</requiredProperty>
      	</requiredProperties>
      

      When I run an archetype generate with those properties specified:

      mvn archetype:generate -B -DarchetypeGroupId=com.example -DarchetypeArtifactId=example-archetype -DgroupName=MyGroup -DserviceName=MyService
      

      I get the following output:

      [INFO] Parent element not overwritten in /private/tmp/${serviceName}/${serviceName}-app/pom.xml
      [INFO] Parent element not overwritten in /private/tmp/${serviceName}/${serviceName}-proxy/pom.xml
      [INFO] Parent element not overwritten in /private/tmp/${serviceName}/${serviceName}-dto/pom.xml
      [INFO] Parent element not overwritten in /private/tmp/${serviceName}/${serviceName}-integration-tests/pom.xml
      [INFO] Parent element not overwritten in /private/tmp/${serviceName}/${serviceName}-codegen/pom.xml
      [INFO] project created from Archetype in dir: /private/tmp/${serviceName}
      

      I'll do a pull request on github.

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user max-norris opened a pull request:

          https://github.com/apache/maven-archetype/pull/14

          Fix for batch mode not being able to replace required properties

          https://issues.apache.org/jira/browse/ARCHETYPE-509

          If I specify a required property and then use that in another required property, as follows:

          ```
          <requiredProperties>
          <requiredProperty key="groupName">
          </requiredProperty>
          <requiredProperty key="serviceName">
          </requiredProperty>
          <requiredProperty key="groupId">
          <defaultValue>com.example.$

          {groupName}</defaultValue>
          </requiredProperty>
          <requiredProperty key="package">
          <defaultValue>com.example.${groupName}

          </defaultValue>
          </requiredProperty>
          <requiredProperty key="artifactId">
          <defaultValue>$

          {serviceName}</defaultValue>
          </requiredProperty>
          <requiredProperty key="version">
          <defaultValue>1.0.0-SNAPSHOT</defaultValue>
          </requiredProperty>
          </requiredProperties>

          ```

          When I run an archetype generate with those properties specified:

          `mvn archetype:generate -B -DarchetypeGroupId=com.example -DarchetypeArtifactId=example-archetype -DgroupName=MyGroup -DserviceName=MyService`

          I get the following output:

          ```
          [INFO] Parent element not overwritten in /private/tmp/${serviceName}

          /$

          {serviceName}-app/pom.xml
          [INFO] Parent element not overwritten in /private/tmp/${serviceName}

          /$

          {serviceName}-proxy/pom.xml
          [INFO] Parent element not overwritten in /private/tmp/${serviceName}

          /$

          {serviceName}-dto/pom.xml
          [INFO] Parent element not overwritten in /private/tmp/${serviceName}

          /$

          {serviceName}-integration-tests/pom.xml
          [INFO] Parent element not overwritten in /private/tmp/${serviceName}

          /$

          {serviceName}-codegen/pom.xml
          [INFO] project created from Archetype in dir: /private/tmp/${serviceName}

          ```

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/max-norris/maven-archetype master

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/maven-archetype/pull/14.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #14


          commit f9e290c350b5918716ecb07c71b698a425ac1273
          Author: Max Norris <mnorris@ancestry.com>
          Date: 2016-09-14T05:20:17Z

          Updating batch mode so it can replace required fields that have property placeholders.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user max-norris opened a pull request: https://github.com/apache/maven-archetype/pull/14 Fix for batch mode not being able to replace required properties https://issues.apache.org/jira/browse/ARCHETYPE-509 If I specify a required property and then use that in another required property, as follows: ``` <requiredProperties> <requiredProperty key="groupName"> </requiredProperty> <requiredProperty key="serviceName"> </requiredProperty> <requiredProperty key="groupId"> <defaultValue>com.example.$ {groupName}</defaultValue> </requiredProperty> <requiredProperty key="package"> <defaultValue>com.example.${groupName} </defaultValue> </requiredProperty> <requiredProperty key="artifactId"> <defaultValue>$ {serviceName}</defaultValue> </requiredProperty> <requiredProperty key="version"> <defaultValue>1.0.0-SNAPSHOT</defaultValue> </requiredProperty> </requiredProperties> ``` When I run an archetype generate with those properties specified: `mvn archetype:generate -B -DarchetypeGroupId=com.example -DarchetypeArtifactId=example-archetype -DgroupName=MyGroup -DserviceName=MyService` I get the following output: ``` [INFO] Parent element not overwritten in /private/tmp/${serviceName} /$ {serviceName}-app/pom.xml [INFO] Parent element not overwritten in /private/tmp/${serviceName} /$ {serviceName}-proxy/pom.xml [INFO] Parent element not overwritten in /private/tmp/${serviceName} /$ {serviceName}-dto/pom.xml [INFO] Parent element not overwritten in /private/tmp/${serviceName} /$ {serviceName}-integration-tests/pom.xml [INFO] Parent element not overwritten in /private/tmp/${serviceName} /$ {serviceName}-codegen/pom.xml [INFO] project created from Archetype in dir: /private/tmp/${serviceName} ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/max-norris/maven-archetype master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/maven-archetype/pull/14.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #14 commit f9e290c350b5918716ecb07c71b698a425ac1273 Author: Max Norris <mnorris@ancestry.com> Date: 2016-09-14T05:20:17Z Updating batch mode so it can replace required fields that have property placeholders.
          Hide
          rfscholte Robert Scholte added a comment -

          Fixed in 9857d346b7ec300cd7834cd4e3e6248770b20a8d
          Thanks for the patch!

          Show
          rfscholte Robert Scholte added a comment - Fixed in 9857d346b7ec300cd7834cd4e3e6248770b20a8d Thanks for the patch!
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-archetype-m3 #247 (See https://builds.apache.org/job/maven-archetype-m3/247/)
          ARCHETYPE-509 RequiredProperty not set in batch mode this closes #14 (rfscholte: rev 9857d346b7ec300cd7834cd4e3e6248770b20a8d)

          • (edit) maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java
          • (add) maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator2Test.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-archetype-m3 #247 (See https://builds.apache.org/job/maven-archetype-m3/247/ ) ARCHETYPE-509 RequiredProperty not set in batch mode this closes #14 (rfscholte: rev 9857d346b7ec300cd7834cd4e3e6248770b20a8d) (edit) maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java (add) maven-archetype-plugin/src/test/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator2Test.java

            People

            • Assignee:
              rfscholte Robert Scholte
              Reporter:
              mnorris1 Max Norris
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development