Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no archetypes in default local catalog when creating new maven project

Tags:

eclipse

maven

Using Eclipse Java EE IDE for Web Developers. Version: Kepler Service Release 2 Build id: 20140224-0627.

When I select File -> new -> Maven Project -> Use Default Workspace Location. I get the following Dialog. Local Default Catalog is empty:

enter image description here

I click Configure button, and then click on Maven Architecture Catalogs. The page says:

Location of catalog files

The Archetype Plugin knows by default about its internal catalog. It also knows about the local and remote catalogs.

local represents the ~/.m2/archetype-catalog.xml catalog file.

remote represents the http://repo.maven.apache.org/maven2/archetype-catalog.xml catalog file.

The Archetype Plugin can also read catalogs from filesystem/HTTP by providing the path/URL of a catalog file or of a directory containing an archetype-catalog.xml file.

If Execute the following on the command line (I have everyhing under tools directory, Eclipse, Maven, WildFly, etc.)

C:\Tools>dir archetype-catalog.xml /s

It doesn't find any file.

So default local catalog doen't exist! Why is that?

I have downloaded http://repo.maven.apache.org/maven2/archetype-catalog.xml, but I don't know where to put it to become the default local catalog, because I don't know what ~/.m2/archetype-catalog.xml file path is. I tried with C:\Tools\eclipse\.m2\archetype-catalog.xml and several other locations without luck. Sorry, I'm new to Java eco-system and Eclipse IDE.

I have the latest M2Eclipse found here: http://download.eclipse.org/technology/m2e/releases

EDIT: I figured out what ~ means on ~/.m2/archetype-catalog.xml. I have put archetype-catalog.xml into c:\users\my.user.name\.m2\ and voilà default local catalog is now full of archetypes. But still. Why it didn't exist in the first place? This is very annoying.

like image 907
Jesús López Avatar asked Sep 11 '25 22:09

Jesús López


2 Answers

The archetype catalogs used by eclipse can be found in Window -> Preferences, then in the section Maven -> Archetypes. If no catalog is listed there, you can add the official maven remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml

like image 134
Roberto Linares Avatar answered Sep 14 '25 13:09

Roberto Linares


No need to configure local archetypes unless you have created your own archetype. In this case, when you install it on your machine, the maven will create the archetype-catalog.xml file on the ~/.m2/repository path. In another case, to retrieve any artifact the only things that you need to do is configure the remote catalog, for example, to configure Spring Catalog, you need the following

Configure Spring Repository

If you see the following screen, you can observe that I don't have anything in my Default Local Catalog similar to you while in All Catalogs, I have the archetypes from other repositories.

Default Catalog Empty

All Catalogs

Finally is important to know the difference between archetypes and dependencies. The archetypes let us create a project from it, the others are the libraries to own the project.

like image 31
martosfre Avatar answered Sep 14 '25 15:09

martosfre