3
votes

[edit] The author confuses creating an archetype and creating a project from an archetype.

How to create a Maven archetype?

I use the last version of Eclipse, Mars 4.5.2, so it already contains a new version Maven plugin. From https://maven.apache.org/guides/mini/guide-creating-archetypes.html, the firt step is "1. Create a new project and pom.xml for the archetype artifact". However, I cannot even create a very, very simple Maven project after trying various most all basic ways, as illustrated below.

If I click 'Create a simple project (skip archetype selection)', I cannot even click both Next or Finish.

enter image description here

If I click 'Use default workspace location', and then click 'Next',

enter image description here

At here, it's forced to click one of the group ids and then click 'Next' to create a maven project. I choose the first one, named 'maven.archetype.archetype', (and tried most of them listed on the image as well), then click next:

enter image description here

The results are constantly:

enter image description here

The images illustrate that I failed to create even a simple Maven project, not to mention a Maven archetype, by all means through Eclipse.

My goal is not creating a Maven project. I already created a GWT web project which was implemented and run smoothly without Maven. I'd like to build a GWT REST application by following the steps in https://ronanquillevere.github.io/2014/03/16/gwt-rest-app.html#.V1IdrPl96M9 and create Java REST API which takes input through url and returns result, achieving the same functionality of my UI. When following ronanquillevere's guide, I am stuck at Maven as one image in https://ronanquillevere.github.io/2014/03/16/gwt-rest-app.html#.V1IdrPl96M9

enter image description here

The question is: how to create Maven archetypes like the guide https://ronanquillevere.github.io/2014/03/16/gwt-rest-app.html#.V1IdrPl96M9 's many org.codehaus.mojo.archetypes? A step-by-step answer with detailed steps and images for achieving it in Eclipse is much better.

1
BTW, do not confuse creating an archetype and creating a project from an archetype.Thomas Broyer

1 Answers

3
votes

This is because the default catalogs (which are basically XML files that list archetypes) in eclipse do not have the archetype you are looking for. You can read more about that topic here.

To solve your problem - on the archetype selection dialog (your third screenshot), click on the "Configure.." button for updating the catalogs.

Click on "Add Remote Catalog.." button and add the catalog URL as http://repo.maven.apache.org/maven2/archetype-catalog.xml and give a description. Click OK. (See screenshot)

Add remote catalog

Now when you return to the archetype selection window, you will see a whole bunch of new archetypes listed which are available in that catalog. You should now be able to type in and choose "org.codehaus.mojo" as illustrated in the tutorial you are following and proceed further.