@@ -113,24 +113,21 @@ public void execute() throws MojoExecutionException, MojoFailureException {
113113 archetypeVersion = artifactResolver .getHighestVersion (mavenProject , distributionGroupId , distributionArtifactId , allowSnapshots );
114114 getLog ().info ("Resolved version " + archetypeVersion );
115115 }
116- Set <String > possibleTypes = findProjectTypes (archetypeGroupId , archetypeVersion , remoteCatalog );
117116 try {
118117 // We have a list of possible types, let the user choose
119- if (!possibleTypes .isEmpty ()) {
120- ArrayList <String > list = new ArrayList <>(possibleTypes );
121- Collections .sort (list );
122- list .add ("custom archetype" );
123- type = prompter .promptList ("Choose the project type" , Value .convertList (list ));
124- } else {
125- getLog ().info ("No " + archetypeVersion + " archetype found, enter coordinates manually" );
126- }
118+ ArrayList <String > list = new ArrayList <>(findProjectTypes (archetypeGroupId , archetypeVersion , remoteCatalog ));
119+ Collections .sort (list );
120+ list .add ("custom archetype" );
121+ type = prompter .promptList ("Choose the project type" , Value .convertList (list ));
127122
128- // No possible types or the user wants to input a custom archetype
129- if (possibleTypes . isEmpty () || "custom archetype" .equals (type )) {
123+ // If the user wants to input a custom archetype
124+ if ("custom archetype" .equals (type )) {
130125 // Ask for archetype group id (defaults to distribution group id)
131126 archetypeGroupId = prompter .promptInput ("Enter the archetype group id" , archetypeGroupId );
132127 // Ask for archetype artifact id
133- archetypeArtifactId = prompter .promptInput ("Enter the archetype artifact id" , "web-archetype" );
128+ while (archetypeArtifactId == null || archetypeArtifactId .isEmpty ()) {
129+ archetypeArtifactId = prompter .promptInput ("Enter the archetype artifact id" , null );
130+ }
134131 // Ask for archetype version (defaults to latest)
135132 try {
136133 archetypeVersion = artifactResolver .getHighestVersion (mavenProject , archetypeGroupId , archetypeArtifactId , allowSnapshots );
@@ -346,6 +343,14 @@ private Set<String> findProjectTypes(String archetypeGroupId, String archetypeVe
346343 getLog ().info ("No remote or central " + archetypeVersion + " archetype found, trying the local catalog" );
347344 possibleTypes .addAll (findArchetypes (archetypeGroupId , archetypeVersion , archetypeManager .getDefaultLocalCatalog ()));
348345 }
346+ if (possibleTypes .isEmpty ()) {
347+ getLog ().warn ("No " + archetypeVersion + " archetype found anywhere (check your Maven proxy settings), falling back to hard-coded list" );
348+ possibleTypes .add ("addon" );
349+ possibleTypes .add ("batch" );
350+ possibleTypes .add ("cli" );
351+ possibleTypes .add ("domain" );
352+ possibleTypes .add ("web" );
353+ }
349354
350355 return possibleTypes ;
351356 }
0 commit comments