@@ -96,7 +96,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
9696 version = mavenSession .getUserProperties ().getProperty ("version" ),
9797 archetypeGroupId = mavenSession .getUserProperties ().getProperty ("archetypeGroupId" ),
9898 archetypeArtifactId = mavenSession .getUserProperties ().getProperty ("archetypeArtifactId" ),
99- archetypeVersion = mavenSession .getUserProperties ().getProperty ("archetypeVersion" );
99+ archetypeVersion = mavenSession .getUserProperties ().getProperty ("archetypeVersion" ),
100+ remoteCatalog = mavenSession .getUserProperties ().getProperty ("remoteCatalog" , SEEDSTACK_ORG );
100101 boolean allowSnapshots = !mavenSession .getUserProperties ().getProperty ("allowSnapshots" , "false" ).equals ("false" );
101102
102103
@@ -112,15 +113,18 @@ public void execute() throws MojoExecutionException, MojoFailureException {
112113 archetypeVersion = artifactResolver .getHighestVersion (mavenProject , distributionGroupId , distributionArtifactId , allowSnapshots );
113114 getLog ().info ("Resolved version " + archetypeVersion );
114115 }
115- Set <String > possibleTypes = findProjectTypes (archetypeGroupId , archetypeVersion );
116+ Set <String > possibleTypes = findProjectTypes (archetypeGroupId , archetypeVersion , remoteCatalog );
116117 try {
117118 // We have a list of possible types, let the user choose
118119 if (!possibleTypes .isEmpty ()) {
119120 ArrayList <String > list = new ArrayList <>(possibleTypes );
120121 Collections .sort (list );
121122 list .add ("custom archetype" );
122123 type = prompter .promptList ("Choose the project type" , Value .convertList (list ));
124+ } else {
125+ getLog ().info ("No " + archetypeVersion + " archetype found, enter coordinates manually" );
123126 }
127+
124128 // No possible types or the user wants to input a custom archetype
125129 if (possibleTypes .isEmpty () || "custom archetype" .equals (type )) {
126130 // Ask for archetype group id (defaults to distribution group id)
@@ -311,21 +315,18 @@ private String processPath(String absolutePath, Map<String, Object> vars) {
311315 }
312316 }
313317
314- private Set <String > findProjectTypes (String archetypeGroupId , String archetypeVersion ) {
318+ private Set <String > findProjectTypes (String archetypeGroupId , String archetypeVersion , String remoteCatalog ) {
315319 Set <String > possibleTypes = new HashSet <>();
316- getLog ().info ("Searching for archetypes in remote catalog" );
317- possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getRemoteCatalog ()));
320+ getLog ().info ("Searching for " + archetypeVersion + " archetypes in remote catalog " + remoteCatalog );
321+ possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getRemoteCatalog (remoteCatalog )));
318322
319323 if (possibleTypes .isEmpty ()) {
320- getLog ().info ("No remote archetype found with version " + archetypeVersion + ", trying the local catalog" );
321- possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getDefaultLocalCatalog ()));
322- }
323- if (possibleTypes .isEmpty ()) {
324- getLog ().info ("No local archetype found with version " + archetypeVersion + ", falling back to seedstack.org" );
325- possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getRemoteCatalog (SEEDSTACK_ORG )));
324+ getLog ().info ("No remote " + archetypeVersion + " archetype found, trying the central catalog" );
325+ possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getRemoteCatalog ()));
326326 }
327327 if (possibleTypes .isEmpty ()) {
328- getLog ().info ("No suitable archetype found" );
328+ getLog ().info ("No remote or central " + archetypeVersion + " archetype found, trying the local catalog" );
329+ possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getDefaultLocalCatalog ()));
329330 }
330331
331332 return possibleTypes ;
0 commit comments