Skip to content

Commit 054e22d

Browse files
[ARCHETYPE-677] Upgrade versions of archetypes in internal catalog
1 parent c159afe commit 054e22d

2 files changed

Lines changed: 29 additions & 30 deletions

File tree

archetype-common/src/main/resources/archetype-catalog.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,32 @@ under the License.
2727
<archetype>
2828
<groupId>org.apache.maven.archetypes</groupId>
2929
<artifactId>maven-archetype-archetype</artifactId>
30-
<version>1.0</version>
30+
<version>1.5</version>
3131
<description>An archetype which contains a sample archetype.</description>
3232
</archetype>
3333
<archetype>
3434
<groupId>org.apache.maven.archetypes</groupId>
3535
<artifactId>maven-archetype-j2ee-simple</artifactId>
36-
<version>1.0</version>
36+
<version>1.5</version>
3737
<description>An archetype which contains a simplifed sample J2EE application.</description>
3838
</archetype>
3939
<archetype>
4040
<groupId>org.apache.maven.archetypes</groupId>
4141
<artifactId>maven-archetype-plugin</artifactId>
42-
<version>1.2</version>
42+
<version>1.5</version>
4343
<description>An archetype which contains a sample Maven plugin.</description>
4444
</archetype>
4545
<archetype>
4646
<groupId>org.apache.maven.archetypes</groupId>
4747
<artifactId>maven-archetype-plugin-site</artifactId>
48-
<version>1.1</version>
48+
<version>1.5</version>
4949
<description>An archetype which contains a sample Maven plugin site.
5050
This archetype can be layered upon an existing Maven plugin project.</description>
5151
</archetype>
5252
<archetype>
5353
<groupId>org.apache.maven.archetypes</groupId>
5454
<artifactId>maven-archetype-portlet</artifactId>
55-
<version>1.0.1</version>
55+
<version>1.5</version>
5656
<description>An archetype which contains a sample JSR-268 Portlet.</description>
5757
</archetype>
5858
<archetype>
@@ -64,27 +64,27 @@ under the License.
6464
<archetype>
6565
<groupId>org.apache.maven.archetypes</groupId>
6666
<artifactId>maven-archetype-quickstart</artifactId>
67-
<version>1.1</version>
67+
<version>1.5</version>
6868
<description>An archetype which contains a sample Maven project.</description>
6969
</archetype>
7070
<archetype>
7171
<groupId>org.apache.maven.archetypes</groupId>
7272
<artifactId>maven-archetype-site</artifactId>
73-
<version>1.1</version>
73+
<version>1.5</version>
7474
<description>An archetype which contains a sample Maven site which demonstrates
7575
some of the supported document types like APT, XDoc, and FML and demonstrates how
7676
to i18n your site. This archetype can be layered upon an existing Maven project.</description>
7777
</archetype>
7878
<archetype>
7979
<groupId>org.apache.maven.archetypes</groupId>
8080
<artifactId>maven-archetype-site-simple</artifactId>
81-
<version>1.1</version>
81+
<version>1.5</version>
8282
<description>An archetype which contains a sample Maven site.</description>
8383
</archetype>
8484
<archetype>
8585
<groupId>org.apache.maven.archetypes</groupId>
8686
<artifactId>maven-archetype-webapp</artifactId>
87-
<version>1.0</version>
87+
<version>1.5</version>
8888
<description>An archetype which contains a sample Maven Webapp project.</description>
8989
</archetype>
9090
</archetypes>

archetype-common/src/test/java/org/apache/maven/archetype/test/InternalCatalogArchetypesVerificationTest.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.maven.archetype.test;
2020

2121
import java.io.File;
22+
import java.util.Properties;
2223

2324
import org.apache.maven.archetype.ArchetypeGenerationRequest;
2425
import org.apache.maven.archetype.ArchetypeGenerationResult;
@@ -63,31 +64,27 @@ public void testInternalCatalog() throws Exception {
6364
outputDirectory.mkdirs();
6465
FileUtils.cleanDirectory(outputDirectory);
6566

66-
ArchetypeManager archetype = (ArchetypeManager) lookup(ArchetypeManager.class.getName());
67+
ArchetypeManager archetypeManager = (ArchetypeManager) lookup(ArchetypeManager.class.getName());
68+
ArchetypeCatalog catalog = archetypeManager.getInternalCatalog();
6769

68-
ArchetypeCatalog catalog = archetype.getInternalCatalog();
70+
// quickstart has a parameters with defaults ... so it should not be needed
71+
// can be connected with ARCHETYPE-574
72+
Properties props = new Properties();
73+
props.put("javaCompilerVersion", "11");
74+
props.put("junitVersion", "5.11.0");
6975

7076
int count = 1;
71-
for (Archetype a : catalog.getArchetypes()) {
72-
Archetype ar = new Archetype();
73-
ar.setGroupId(a.getGroupId());
74-
ar.setArtifactId(a.getArtifactId());
75-
ar.setVersion(a.getVersion());
76-
ar.setDescription(a.getDescription());
77-
ar.setGoals(a.getGoals());
78-
ar.setProperties(a.getProperties());
79-
ar.setRepository(a.getRepository());
80-
if (ar.getRepository() == null) {
81-
ar.setRepository(CENTRAL);
82-
}
83-
84-
ArchetypeGenerationRequest request = new ArchetypeGenerationRequest(ar)
85-
.setGroupId("org.apache.maven.archetype.test")
86-
.setArtifactId("archetype" + count)
77+
for (Archetype archetype : catalog.getArchetypes()) {
78+
// this should be also default ...
79+
archetype.setRepository(CENTRAL);
80+
81+
ArchetypeGenerationRequest request = new ArchetypeGenerationRequest(archetype)
82+
.setGroupId("org.apache.maven.archetypeManager.test")
83+
.setArtifactId("archetypeManager" + count)
8784
.setVersion("1.0-SNAPSHOT")
8885
.setPackage("com.acme")
86+
.setProperties(props)
8987
.setOutputDirectory(outputDirectory.getPath());
90-
// .setLocalRepository(localRepository);
9188

9289
ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
9390
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
@@ -98,9 +95,11 @@ public void testInternalCatalog() throws Exception {
9895
buildingRequest.setRepositorySession(repositorySession);
9996
request.setProjectBuildingRequest(buildingRequest);
10097

101-
ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype(request);
98+
ArchetypeGenerationResult generationResult = archetypeManager.generateProjectFromArchetype(request);
10299

103-
assertNull("Archetype wasn't generated successfully", generationResult.getCause());
100+
assertNull(
101+
"Archetype wasn't generated successfully: " + generationResult.getCause(),
102+
generationResult.getCause());
104103

105104
count++;
106105
}

0 commit comments

Comments
 (0)