Skip to content

Commit ac9d130

Browse files
Lock down plugin versions in maven-archetype packaging
All versions for plugins used in packaging binding should be defined.
1 parent 367d66c commit ac9d130

File tree

14 files changed

+55
-110
lines changed

14 files changed

+55
-110
lines changed

archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import org.apache.maven.model.Extension;
6363
import org.apache.maven.model.Model;
6464
import org.apache.maven.model.Plugin;
65-
import org.apache.maven.model.PluginManagement;
6665
import org.apache.maven.model.Profile;
6766
import org.apache.maven.model.Resource;
6867
import org.apache.maven.project.MavenProject;
@@ -427,15 +426,6 @@ private File createArchetypeProjectPom(MavenProject project, Properties configur
427426
extension.setVersion(getArchetypeVersion());
428427
model.getBuild().addExtension(extension);
429428

430-
Plugin plugin = new Plugin();
431-
plugin.setGroupId("org.apache.maven.plugins");
432-
plugin.setArtifactId("maven-archetype-plugin");
433-
plugin.setVersion(getArchetypeVersion());
434-
435-
PluginManagement pluginManagement = new PluginManagement();
436-
pluginManagement.addPlugin(plugin);
437-
model.getBuild().setPluginManagement(pluginManagement);
438-
439429
LOGGER.debug("Creating archetype's pom");
440430

441431
File archetypePomFile = new File(projectDir, Constants.ARCHETYPE_POM);

archetype-packaging/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,13 @@
3131
<name>Maven Archetype Packaging</name>
3232
<description>'maven-archetype' packaging configuration for archetypes.</description>
3333

34+
<build>
35+
<resources>
36+
<resource>
37+
<filtering>true</filtering>
38+
<directory>src/main/resources</directory>
39+
</resource>
40+
</resources>
41+
</build>
42+
3443
</project>

archetype-packaging/src/main/resources/META-INF/plexus/components.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
<configuration>
2727
<!-- START SNIPPET: maven-archetype-lifecycle -->
2828
<phases>
29-
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
30-
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
31-
<package>org.apache.maven.plugins:maven-archetype-plugin:jar</package>
32-
<integration-test>org.apache.maven.plugins:maven-archetype-plugin:integration-test</integration-test>
33-
<install>org.apache.maven.plugins:maven-install-plugin:install,
34-
org.apache.maven.plugins:maven-archetype-plugin:update-local-catalog
29+
<process-resources>org.apache.maven.plugins:maven-resources-plugin:${version.maven-resources-plugin}:resources</process-resources>
30+
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:${version.maven-resources-plugin}:testResources</process-test-resources>
31+
<package>org.apache.maven.plugins:maven-archetype-plugin:${project.version}:jar</package>
32+
<integration-test>org.apache.maven.plugins:maven-archetype-plugin:${project.version}:integration-test</integration-test>
33+
<install>org.apache.maven.plugins:maven-install-plugin:${version.maven-install-plugin}:install,
34+
org.apache.maven.plugins:maven-archetype-plugin:${project.version}:update-local-catalog
3535
</install>
36-
<!-- Update the local catalog -->
37-
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
36+
<deploy>org.apache.maven.plugins:maven-deploy-plugin:${version.maven-deploy-plugin}:deploy</deploy>
3837
</phases>
3938
<!-- END SNIPPET: maven-archetype-lifecycle -->
4039
</configuration>

archetype-packaging/src/site/apt/index.apt.vm

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ Usage
4646

4747
Declaring <<<maven-archetype>>> packaging to your pom is not the only step required:
4848

49-
* to be available from an the archetype project, the packaging must be added as an extension,
50-
51-
* to ensure a reproducible build, the archetype plugin version needs to be locked down in pluginManagement section.
49+
* to be available from the archetype project, the packaging must be added as an extension,
5250

5351
[]
5452

@@ -67,16 +65,6 @@ Usage
6765
<version>${project.version}</version>
6866
</extension>
6967
</extensions>
70-
71-
<pluginManagement>
72-
<plugins>
73-
<plugin>
74-
<groupId>org.apache.maven.plugins</groupId>
75-
<artifactId>maven-archetype-plugin</artifactId>
76-
<version>${project.version}</version>
77-
</plugin>
78-
</plugins>
79-
</pluginManagement>
8068
</build>
8169
</project>
8270
+---

maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/archetype/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,18 @@ under the License.
3131
<packaging>maven-archetype</packaging>
3232

3333
<build>
34+
<extensions>
35+
<extension>
36+
<groupId>org.apache.maven.archetype</groupId>
37+
<artifactId>archetype-packaging</artifactId>
38+
<version>@project.version@</version>
39+
</extension>
40+
</extensions>
41+
3442
<plugins>
3543
<plugin>
3644
<groupId>org.apache.maven.plugins</groupId>
3745
<artifactId>maven-archetype-plugin</artifactId>
38-
<extensions>true</extensions>
3946
<configuration>
4047
<archetypeDirectory>src/main/resources</archetypeDirectory>
4148
</configuration>

maven-archetype-plugin/src/it/projects/ARCHETYPE-241_filter-directory/pom.xml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,9 @@ under the License.
2626
<artifactId>archetype241-parent</artifactId>
2727
<version>1.0-SNAPSHOT</version>
2828
<packaging>pom</packaging>
29-
30-
<build>
31-
<extensions>
32-
<extension>
33-
<groupId>org.apache.maven.archetype</groupId>
34-
<artifactId>archetype-packaging</artifactId>
35-
<version>@project.version@</version>
36-
</extension>
37-
</extensions>
38-
39-
<pluginManagement>
40-
<plugins>
41-
<plugin>
42-
<groupId>org.apache.maven.plugins</groupId>
43-
<artifactId>maven-archetype-plugin</artifactId>
44-
<version>@project.version@</version>
45-
</plugin>
46-
</plugins>
47-
</pluginManagement>
48-
</build>
29+
30+
<modules>
31+
<module>archetype</module>
32+
</modules>
33+
4934
</project>

maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/archetype/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ under the License.
3131
<packaging>maven-archetype</packaging>
3232

3333
<build>
34+
<extensions>
35+
<extension>
36+
<groupId>org.apache.maven.archetype</groupId>
37+
<artifactId>archetype-packaging</artifactId>
38+
<version>@project.version@</version>
39+
</extension>
40+
</extensions>
41+
3442
<plugins>
3543
<plugin>
3644
<groupId>org.apache.maven.plugins</groupId>

maven-archetype-plugin/src/it/projects/ARCHETYPE-536_groovy-grape/pom.xml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,9 @@ under the License.
2626
<artifactId>archetype536-parent</artifactId>
2727
<version>1.0-SNAPSHOT</version>
2828
<packaging>pom</packaging>
29-
30-
<build>
31-
<extensions>
32-
<extension>
33-
<groupId>org.apache.maven.archetype</groupId>
34-
<artifactId>archetype-packaging</artifactId>
35-
<version>@project.version@</version>
36-
</extension>
37-
</extensions>
38-
39-
<pluginManagement>
40-
<plugins>
41-
<plugin>
42-
<groupId>org.apache.maven.plugins</groupId>
43-
<artifactId>maven-archetype-plugin</artifactId>
44-
<version>@project.version@</version>
45-
</plugin>
46-
</plugins>
47-
</pluginManagement>
48-
</build>
29+
30+
<modules>
31+
<module>archetype</module>
32+
</modules>
4933

5034
</project>

maven-archetype-plugin/src/it/projects/ARCHETYPE-679_groovy-modules/archetype/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ under the License.
3131
<packaging>maven-archetype</packaging>
3232

3333
<build>
34+
<extensions>
35+
<extension>
36+
<groupId>org.apache.maven.archetype</groupId>
37+
<artifactId>archetype-packaging</artifactId>
38+
<version>@project.version@</version>
39+
</extension>
40+
</extensions>
41+
3442
<plugins>
3543
<plugin>
3644
<groupId>org.apache.maven.plugins</groupId>

maven-archetype-plugin/src/it/projects/ARCHETYPE-679_groovy-modules/pom.xml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,9 @@ under the License.
2626
<artifactId>archetype679-parent</artifactId>
2727
<version>1.0-SNAPSHOT</version>
2828
<packaging>pom</packaging>
29-
30-
<build>
31-
<extensions>
32-
<extension>
33-
<groupId>org.apache.maven.archetype</groupId>
34-
<artifactId>archetype-packaging</artifactId>
35-
<version>@project.version@</version>
36-
</extension>
37-
</extensions>
38-
39-
<pluginManagement>
40-
<plugins>
41-
<plugin>
42-
<groupId>org.apache.maven.plugins</groupId>
43-
<artifactId>maven-archetype-plugin</artifactId>
44-
<version>@project.version@</version>
45-
</plugin>
46-
</plugins>
47-
</pluginManagement>
48-
</build>
29+
30+
<modules>
31+
<module>archetype</module>
32+
</modules>
4933

5034
</project>

maven-archetype-plugin/src/it/projects/build-and-run-its/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ under the License.
5656
<properties>
5757
<maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
5858
<maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
59-
6059
</properties>
6160
</configuration>
6261
</plugin>

maven-archetype-plugin/src/it/projects/build-ignore-eol/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ under the License.
4646

4747
<pluginManagement>
4848
<plugins>
49-
<plugin>
50-
<artifactId>maven-compiler-plugin</artifactId>
51-
<version>3.7.0</version>
52-
</plugin>
5349
<plugin>
5450
<artifactId>maven-archetype-plugin</artifactId>
5551
<version>@project.version@</version>

maven-archetype-plugin/src/it/projects/create-4/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<packaging>pom</packaging>
3434

3535
<modules>
36-
<module>subModuleWar</module>
36+
<module>subModuleWar</module>
3737
<module>subModuleEAR</module>
3838
</modules>
3939
</project>

maven-archetype-plugin/src/it/projects/create-5/pom.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,4 @@
3131
<name>Maven archetype Test create-5</name>
3232
<packaging>pom</packaging>
3333

34-
<build>
35-
<pluginManagement>
36-
<plugins>
37-
<plugin>
38-
<groupId>org.apache.maven.plugins</groupId>
39-
<artifactId>maven-ear-plugin</artifactId>
40-
<version>2.10</version>
41-
</plugin>
42-
</plugins>
43-
</pluginManagement>
44-
</build>
45-
4634
</project>

0 commit comments

Comments
 (0)