This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch ARCHETYPE-677 in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
commit 24a07882ba324a0bc0ba6438ac1b5dd5460e0a8b Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat Sep 14 12:44:07 2024 +0200 [ARCHETYPE-677] Upgrade versions of archetypes in internal catalog --- .../src/main/resources/archetype-catalog.xml | 18 +++++----- .../InternalCatalogArchetypesVerificationTest.java | 41 +++++++++++----------- 2 files changed, 29 insertions(+), 30 deletions(-) diff --git a/archetype-common/src/main/resources/archetype-catalog.xml b/archetype-common/src/main/resources/archetype-catalog.xml index ac927bb0..e09f28c6 100644 --- a/archetype-common/src/main/resources/archetype-catalog.xml +++ b/archetype-common/src/main/resources/archetype-catalog.xml @@ -27,32 +27,32 @@ under the License. <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-archetype</artifactId> - <version>1.0</version> + <version>1.5</version> <description>An archetype which contains a sample archetype.</description> </archetype> <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-j2ee-simple</artifactId> - <version>1.0</version> + <version>1.5</version> <description>An archetype which contains a simplifed sample J2EE application.</description> </archetype> <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-plugin</artifactId> - <version>1.2</version> + <version>1.5</version> <description>An archetype which contains a sample Maven plugin.</description> </archetype> <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-plugin-site</artifactId> - <version>1.1</version> + <version>1.5</version> <description>An archetype which contains a sample Maven plugin site. This archetype can be layered upon an existing Maven plugin project.</description> </archetype> <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-portlet</artifactId> - <version>1.0.1</version> + <version>1.5</version> <description>An archetype which contains a sample JSR-268 Portlet.</description> </archetype> <archetype> @@ -64,13 +64,13 @@ under the License. <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-quickstart</artifactId> - <version>1.1</version> + <version>1.5</version> <description>An archetype which contains a sample Maven project.</description> </archetype> <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-site</artifactId> - <version>1.1</version> + <version>1.5</version> <description>An archetype which contains a sample Maven site which demonstrates some of the supported document types like APT, XDoc, and FML and demonstrates how to i18n your site. This archetype can be layered upon an existing Maven project.</description> @@ -78,13 +78,13 @@ under the License. <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-site-simple</artifactId> - <version>1.1</version> + <version>1.5</version> <description>An archetype which contains a sample Maven site.</description> </archetype> <archetype> <groupId>org.apache.maven.archetypes</groupId> <artifactId>maven-archetype-webapp</artifactId> - <version>1.0</version> + <version>1.5</version> <description>An archetype which contains a sample Maven Webapp project.</description> </archetype> </archetypes> diff --git a/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerificationTest.java b/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerificationTest.java index ad32db85..b986145c 100644 --- a/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerificationTest.java +++ b/archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerificationTest.java @@ -19,6 +19,7 @@ package org.apache.maven.archetype.test; import java.io.File; +import java.util.Properties; import org.apache.maven.archetype.ArchetypeGenerationRequest; import org.apache.maven.archetype.ArchetypeGenerationResult; @@ -63,31 +64,27 @@ public class InternalCatalogArchetypesVerificationTest extends PlexusTestCase { outputDirectory.mkdirs(); FileUtils.cleanDirectory(outputDirectory); - ArchetypeManager archetype = (ArchetypeManager) lookup(ArchetypeManager.class.getName()); + ArchetypeManager archetypeManager = (ArchetypeManager) lookup(ArchetypeManager.class.getName()); + ArchetypeCatalog catalog = archetypeManager.getInternalCatalog(); - ArchetypeCatalog catalog = archetype.getInternalCatalog(); + // quickstart has a parameters with defaults ... so it should not be needed + // can be connected with ARCHETYPE-574 + Properties props = new Properties(); + props.put("javaCompilerVersion", "11"); + props.put("junitVersion", "5.11.0"); int count = 1; - for (Archetype a : catalog.getArchetypes()) { - Archetype ar = new Archetype(); - ar.setGroupId(a.getGroupId()); - ar.setArtifactId(a.getArtifactId()); - ar.setVersion(a.getVersion()); - ar.setDescription(a.getDescription()); - ar.setGoals(a.getGoals()); - ar.setProperties(a.getProperties()); - ar.setRepository(a.getRepository()); - if (ar.getRepository() == null) { - ar.setRepository(CENTRAL); - } - - ArchetypeGenerationRequest request = new ArchetypeGenerationRequest(ar) - .setGroupId("org.apache.maven.archetype.test") - .setArtifactId("archetype" + count) + for (Archetype archetype : catalog.getArchetypes()) { + // this should be also default ... + archetype.setRepository(CENTRAL); + + ArchetypeGenerationRequest request = new ArchetypeGenerationRequest(archetype) + .setGroupId("org.apache.maven.archetypeManager.test") + .setArtifactId("archetypeManager" + count) .setVersion("1.0-SNAPSHOT") .setPackage("com.acme") + .setProperties(props) .setOutputDirectory(outputDirectory.getPath()); - // .setLocalRepository(localRepository); ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); @@ -98,9 +95,11 @@ public class InternalCatalogArchetypesVerificationTest extends PlexusTestCase { buildingRequest.setRepositorySession(repositorySession); request.setProjectBuildingRequest(buildingRequest); - ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype(request); + ArchetypeGenerationResult generationResult = archetypeManager.generateProjectFromArchetype(request); - assertNull("Archetype wasn't generated successfully", generationResult.getCause()); + assertNull( + "Archetype wasn't generated successfully: " + generationResult.getCause(), + generationResult.getCause()); count++; }