Why is Eclipse Maven Archetype plugin not showing my locally installed Maven archetype? - eclipse-plugin

I installed the Maven archetype java8-junit5-archetype locally, but when I try to create a new Maven project in Eclipse, the Maven Archetype plugin doesn't list it.
I manually added the entry to the local catalog file ~/.m2/archetype-catalog.xml as such:
<archetype>
<groupId>com.tbp</groupId>
<artifactId>java8-junit5-archetype</artifactId>
<version>1.0-SNAPSHOT</version>
<repository></repository>
</archetype>
But In Eclipse, I don't see java8-junit5-archetype listed.

Root Cause
It turns out the reason why the java8-junit5-archetype wasn't listed, is because its version is 1.0-SNAPSHOT. That makes it a snapshot archetype.
Solution
Check the Include snapshot archetypes checkbox. Now the archetype is listed.

Related

How to refresh lib folder when update pom.xml?

I create a simple sample Spring MVC project, where IntelliJ 14 by default generate a pom with
<properties>
<spring.version>4.1.4.RELEASE</spring.version>
</properties>
I change it to
<properties>
<spring.version>3.2.0.RELEASE</spring.version>
</properties>
and choose Maven -> Reimport, I can see the dependencies are downloaded to my local .m2 folder
However, when I expend lib folder, all dependencies stays with previous version:
How can I get the latest dependencies showing in \lib folder? I tried to synchronize current project, but it doesn't help this matter
UPDATE
here is my maven setting
UPDATE 2
I forget some detail, which is I create a Spring MVC project in the beginning(so I think it may not be a maven project at the moment), then I right click pom.xml and set current project to maven project.
So I think the jar files listed in \lib folder may be downloaeded via intellij for Spring MVC application, however when I set current project to maven project, it does not remove or update the jar file under the \lib folder.
You should do:
1. Choose menu File \ Project Settings..., In section Build, Execution, Deployment \ Build Tools \ Maven \ Importing, check Import Maven projects automatically. It means IntelliJ IDEA will Synchronize Maven project model and IDEA project model each time when pom.xml is changed.
2. Try closing project, restart IntelliJ IDEA, then reopen the project.
3. Check your internet connection.
IntelliJ isn't shouldn't be looking there for your Maven project dependencies. It is should be using the libraries and resources in your .m2 directory instead.
Mind you, I've left those comments struck out on purpose; depending on your configuration, you may accidentally be doing that.
This is a picture of what the Dozer project looks like. It's a Maven project which I cloned a ways back to see how it worked.
You're going to have to check your Project Structure (Ctrl + Alt + Shift + S) to ensure that the libraries that are coming through are prefixed with "Maven:".
If they are, then the files in your lib folder aren't being used by your project.
In all actuality, those are your global libraries (which you can also find under Project Structure > Global Libraries). Any project has access to them.
If that's causing a conflict, consider deleting those JARs from your global libraries. If you need them for another project, consider adding it to the project's local libraries instead.

How to deploy pom.xml as SNAPSHOT with maven?

I have a pom.xml and i want to use it as the parent pom.xml of my project.
and want to make the name for the pom.xml which was uploaded on Nexus like ABC-root-pom-2.0.0-SNAPSHOT.pom
so could anyone tell me what the command is using maven ?
Thanks
Do not worry about what name the pom will have on the repository manager. The Maven repository format dictates that.
To get a Maven project with pom packaging deployed you have to do the normal steps of adding the distributionManagment to the pom and the credentials to the settings.xml. Then you run
mvn clean deploy
and thats it. Your other project can then reference it. An example for such a pom project is my progressive-organization-pom.

Maven Unique Version in Jar File Name

I am using Maven with Nexus for building my project with hudson ci. Everytime when I am deploying a new snapshot artifact he is doing this with a unique version in nexus. Which is OK for me as Nexus is giving me always the latest version.
Now I looked into the war file of my project which is using this snapshot dependency and its having the following jar file in its lib directory which is absolutely not fine:
framework-client-1.1-20120302.141044-3.jar
The problem is that I am using EBean as an ORM and I need to specify the jar name in the ebean.properties to let him know where to find its models.
How can I prevent such behaviour so that the latest snapshot dep is always call framework-client-1.1-SNAPSHOT.jar?
Thank you!
Just rename the jar in the war file to whatever name you like. Details are here
Renaming Maven dependency in WAR's WEB-INF/lib folder

IntelliJ IDEA: "Indexed Maven Repositories" list - how to add remote maven repository in this list?

I'm having trouble understanding how to get repositories in the "Indexed Maven Repositories" list of the IntelliJ IDEA.
In one my project I have two repos in this list: one local and one (main) remote (see attached screenshot below). And in other project (created using AppFuse template) I have only one (local) repo in list.
I'm tried to add the repos in pom.xml file and in settings.xml file, but the repos did not appear in this "magic" list.
And this means:
I can't see artifactId and versions of artifacts in dropdownlist (Ctrl+SPACE)
IDEA can't find the necessary artifacts (or his versions). It is looking only in my local repo
Version of IntelliJ IDEA: 11.0
Version of Maven: 2.2.1
This list is updated automatically from the repositories specified in your pom files (or inherited from parent project's pom and settings.xml).
If you open a project that has some additional repositories specified, you'll see them in this list and will be able to update the indices.
You can manage these settings by editing your settings.xml file of the project
Open the Project file list (Ctrl-1)
Find your main parent pom.xml file
Right click on it Choose Maven -> Open 'settings.xml'
As you can see it is a local copy of settings.xml file for your project.
There is you can add/remove active repositories of the project.
Look at the settings->repositories manual for details.
I had a related issue where I changed the repository in my settings.xml but the Indexed Maven Repositories list was still pointing to the old one. In order to get the maven build to look at the new one I had to run mvn idea:idea on the project

Missing directory in a Maven Directory Structure with Eclipse

I recently set up a j2ee development environment under Ubuntu: Eclipse (Helios) with the maven plugin (m2eclipse).
When I try to create a maven project, it tells me to select an "Archetype".
Then, I select an Archetype with a GroupId : "org.apache.maven.archetypes" and the
ArctifactId : "maven-archetype-quickstart" (I tried also with the followinf artifactIds
"maven-archetype-mojo" "maven-archetype-j2ee-simple", ....).
Then, it creates a standard maven directory structure.
I added the "javax.perssitence" Maven Dependency that load the "persistence-api-1.0.jar".
But I can't find the "src/main/ressources" and "src/test/ressources" to access to the "persistence.xml" file.
Is it a bug? Should I create it manually?
Thank you for your answers ;)
No, it's not a bug, just create them manually and update the project configuration under Eclipse (via right-click on the project and Maven > Update Project Configuration)