Hi Petar, Nice work!
I had a look, and I am a bit confused: is it about post-*generate*, ie after a project is generated from an archetype, or about post-*create*, ie after an archetype project is built from a sample project? See the workflow drawing I did to try to make that clear [1] Because the Jira issue tells that it's about post-generate, but the script constant is ARCHETYPE_POST_GENERATION_SCRIPT = "META-INF/post_create.groovy" and a lot of generated classes are about create (ArchetypeCreationRequest, CreateArchetypeFromProjectMojo, FilesetArchetypeCreator). I see that Groovy script execution is in DefaultFilesetArchetypeGenerator, then it's really in archetype:generate, but then I don't understand what's the purpose of the code in archetype:create-from-project. And the "archetype.postScript" property name doesn't seem a good choice, since IMHO causes confusion with "archetype.postPhase": "archetype.postGenerateScript" would be better. But even the existence of this property seems questionable: can't it just be in a particular location in sample project, so it gets copied into META-INF/archetype-post-generate.groovy (whatever the ARCHETYPE_POST_GENERATION_SCRIPT constant will point to)? I suppose some additional example in plugin's documentation, would make the feature easier to understand from an end-user point of view. It's a good idea: let's continue! Regards, Hervé [1] http://maven.apache.org/archetype/maven-archetype-plugin/ Le jeudi 17 décembre 2015 23:40:28 Petar Tahchiev a écrit : > Hello all, > > I've been having this idea to modify the resulting project after generating > from a given archetype. In my particular case I'd like to be able to delete > certain files, modify the pom.xml to add/remove dependencies, etc. After > speaking with Herve Boutemy he suggested it would be a nice addition to the > maven archetype plugin to be able to run a script after the project is > generated from an archetype. I filed the enhancement here: > > https://issues.apache.org/jira/browse/ARCHETYPE-494 > > I've also implemented it in a separate branch here: > > https://git1-us-west.apache.org/repos/asf?p=maven-archetype.git;a=commit;h=d > 60b876506e9b60ffa115c63425f837793fcaacf > > The idea is very basic - if the archetype plugin finds a file called > "post_create.groovy" in META-INF folder it will try to execute it, passing > all the environment variables to it. I've also added a sample test-case. > > I'd really like if someone takes a look on it before I merge it. Please > share your comments here. > > Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
