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. org.apache.maven.archetypes maven-archetype-archetype - 1.0 + 1.5 An archetype which contains a sample archetype. org.apache.maven.archetypes maven-archetype-j2ee-simple - 1.0 + 1.5 An archetype which contains a simplifed sample J2EE application. org.apache.maven.archetypes maven-archetype-plugin - 1.2 + 1.5 An archetype which contains a sample Maven plugin. org.apache.maven.archetypes maven-archetype-plugin-site - 1.1 + 1.5 An archetype which contains a sample Maven plugin site. This archetype can be layered upon an existing Maven plugin project. org.apache.maven.archetypes maven-archetype-portlet - 1.0.1 + 1.5 An archetype which contains a sample JSR-268 Portlet. @@ -64,13 +64,13 @@ under the License. org.apache.maven.archetypes maven-archetype-quickstart - 1.1 + 1.5 An archetype which contains a sample Maven project. org.apache.maven.archetypes maven-archetype-site - 1.1 + 1.5 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. @@ -78,13 +78,13 @@ under the License. org.apache.maven.archetypes maven-archetype-site-simple - 1.1 + 1.5 An archetype which contains a sample Maven site. org.apache.maven.archetypes maven-archetype-webapp - 1.0 + 1.5 An archetype which contains a sample Maven Webapp project. 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 void testInternalCatalog() throws Exception { 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 void testInternalCatalog() throws Exception { 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++; }