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

Provide a way to change the generated project after archetype:generate execution

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:
      None

      Description

      It would be a nice enhancement to be able to modify the created project after archetype:generate execution (create/update/delete files, update dependencies in pom.xml, etc).

      The way I see it this can be achieved by providing a special script that will be executed every time a project is generated from the archetype.

        Issue Links

          Activity

          Show
          paranoiabla Petar Tahchiev added a comment - This has been fixed here: https://github.com/apache/maven-archetype/commit/ac7c4f0ab2e4078c0ea7879e043963c0dd7105f0
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-archetype-m3 #200 (See https://builds.apache.org/job/maven-archetype-m3/200/)
          ARCHETYPE-494 don't hardcode outputDirectory (hboutemy: rev 6b0b51c06e98284d245275b2cbf39df4db16e2e5)

          • archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/archetype-post-generate.groovy
          • archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java
          • archetype-common/src/test/java/org/apache/maven/archetype/repositorycrawler/DefaultRepositoryCrawlerTest.java
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-archetype-m3 #200 (See https://builds.apache.org/job/maven-archetype-m3/200/ ) ARCHETYPE-494 don't hardcode outputDirectory (hboutemy: rev 6b0b51c06e98284d245275b2cbf39df4db16e2e5) archetype-common/src/test/archetypes/fileset_with_postscript-1.0/META-INF/archetype-post-generate.groovy archetype-common/src/test/java/org/apache/maven/archetype/generator/DefaultArchetypeGeneratorTest.java archetype-common/src/test/java/org/apache/maven/archetype/repositorycrawler/DefaultRepositoryCrawlerTest.java
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user ptahchiev commented on the issue:

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

          Hello,
          I think what you are asking is in the context of this issue:

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

          I have it already implemented and will be included in the next version of the maven archetype plugin. There you can specify a groovy file, which will be executed after the archetype generation. I personally use this groovy file to do something similar: I read properties from the command line and then remove declared dependencies, classes and jsp files which the user might not need.

          Please let me know if that helps so I can close this pull request.

          Show
          githubbot ASF GitHub Bot added a comment - Github user ptahchiev commented on the issue: https://github.com/apache/maven-archetype/pull/9 Hello, I think what you are asking is in the context of this issue: https://issues.apache.org/jira/browse/ARCHETYPE-494 I have it already implemented and will be included in the next version of the maven archetype plugin. There you can specify a groovy file, which will be executed after the archetype generation. I personally use this groovy file to do something similar: I read properties from the command line and then remove declared dependencies, classes and jsp files which the user might not need. Please let me know if that helps so I can close this pull request.
          Hide
          matinh Martin Höller added a comment -

          Could you please also add some documentation how to use the new feature? From the commit I found out the name of the script is "META-INF/archetype-post-generate.groovy". But from the current documentation at https://maven.apache.org/archetype/maven-archetype-plugin/ a new user wouldn't even have a clue that such a feature exists.

          Show
          matinh Martin Höller added a comment - Could you please also add some documentation how to use the new feature? From the commit I found out the name of the script is "META-INF/archetype-post-generate.groovy". But from the current documentation at https://maven.apache.org/archetype/maven-archetype-plugin/ a new user wouldn't even have a clue that such a feature exists.
          Hide
          paranoiabla Petar Tahchiev added a comment -

          Hi Martin,

          the Advanced Usage page has a section at the very bottom regarding this issue:

          https://maven.apache.org/archetype/maven-archetype-plugin/advanced-usage.html

          Show
          paranoiabla Petar Tahchiev added a comment - Hi Martin, the Advanced Usage page has a section at the very bottom regarding this issue: https://maven.apache.org/archetype/maven-archetype-plugin/advanced-usage.html
          Hide
          matinh Martin Höller added a comment -

          Ah, thanks Petar!
          Fair enough. And now there is this additional link to it, so the chance a user finds it further increased

          Show
          matinh Martin Höller added a comment - Ah, thanks Petar! Fair enough. And now there is this additional link to it, so the chance a user finds it further increased

            People

            • Assignee:
              paranoiabla Petar Tahchiev
              Reporter:
              paranoiabla Petar Tahchiev
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development