-
Notifications
You must be signed in to change notification settings - Fork 175
Description
Affected version
3.4.1
Bug description
we have a archetype-post-generate.groovy that needs to run another maven call from within a script to do some extra work after the project was generated from the archetype. we need to make sure, that this "nested" maven call used the same maven settings XML file that the user has provided when running maven initially.
this works in the groovy script buy using a statement like this to get a references to the provides user settings file:
def mavenSettings = request.mavenSession?.request?.userSettingsFile?.absolutePath
because a reference to MavenSession is provided in
Lines 108 to 110 in 12168e3
| public MavenSession getMavenSession() { | |
| return mavenSession; | |
| } |
however, when generating a maven project not via the generate goal, but via running an integration test via the integration-test goal, the maven setting in ArchetypeGenerationRequest is null, because it's not passed over here:
Lines 495 to 505 in 12168e3
| ArchetypeGenerationRequest request = new ArchetypeGenerationRequest() | |
| .setArchetypeGroupId(archetypeGroupId) | |
| .setArchetypeArtifactId(archetypeArtifactId) | |
| .setArchetypeVersion(archetypeVersion) | |
| .setGroupId(properties.getProperty(Constants.GROUP_ID)) | |
| .setArtifactId(properties.getProperty(Constants.ARTIFACT_ID)) | |
| .setVersion(properties.getProperty(Constants.VERSION)) | |
| .setPackage(properties.getProperty(Constants.PACKAGE)) | |
| .setRepositorySession(session.getRepositorySession()) | |
| .setOutputDirectory(basedir) | |
| .setProperties(properties); |
in my pov it doesn't make sense to provide less context properties in ITs compared to the actual run of a plugin. i will provide a PR that passed over the maven sesssion also for the IT runs.