m2eclipse Indexing 3rd-party jars from Maven repository - maven-2

I am using Nexus repository. and using Eclipse 3.4 with m2eclipse plugin installed. sometimes I need to upload jars that are not located in the central repositories (Like Sun jars). so I upload them under the "3rd-Party" section in Nexus.
The problem is that when trying to add those jars as dependencies, eclipse does not index them and therefore they are not offered as options.
Any ideas,
Thanks,
Ronen.

I use third party jars in my project using Nexus and I am able to see them with the m2eclipse plugin by doing the following:
Right click on project --> Maven -->
Update Dependencies
Also, it may be important to note that I defined the following in my pom.xml as well (not in settings.xml).
<repositories>
<repository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>public</id>
<name>Maven 2 Repository (Releases)</name>
<url>http://your.domain.com/nexus/content/groups/public</url>
<layout>default</layout>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
<id>public-snapshots</id>
<name>Maven 2 Repository (Snapshots)</name>
<url>http://your.domain.com/nexus/content/groups/public-snapshots</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>public</id>
<name>Maven 2 Repository (Releases)</name>
<url>http://your.domain.com/nexus/content/groups/public</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
<id>public-snapshots</id>
<name>Maven 2 Repository (Snapshots)</name>
<url>http://your.domain.com/nexus/content/groups/public-snapshots</url>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>

settings.xml is simpler:
<mirror>
<id>public</id>
<url>http://yourserver/nexus-webapp-1.5.0/content/groups/public/</url>
<mirrorOf>*</mirrorOf>
</mirror>

Related

How can i get sample .settings file?

I need a .settings file, is there any common repository to access dependent jars ?
i need to access dependents for Mule projects,
Please assist.
Which .settings file are you referring to ? You mean settings.xml from maven to get access to MuleSoft repository and retrieve necessary dependencies ?
If this is the case... https://docs.mulesoft.com/mule-user-guide/v/3.8/configuring-maven-to-work-with-mule-esb
In that link you can find all the info you need to download Mule dependencies in your project.
Example:
<repositories>
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshot Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>
NOTE: for EE ( enterprise edition) dependencies you will need usename and password that must be provided by MuleSoft team, if you are not aware of your username and password, get in touch with your company or contact with Mulesoft
These are the common repositories which you need to include in your project
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Releases Repository</name>
<url>http://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>mulesoft-snapshots</id>
<name>MuleSoft Snapshots Repository</name>
<url>http://repository.mulesoft.org/snapshots/</url>
<layout>default</layout>
</repository>

Maven Failing download the JBoss dependency

Below are my maven settings from behind the proxy
User Settings:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\path\mvn_repo</localRepository>
<pluginGroups></pluginGroups>
<proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<username>myusername</username>
<password>password</password>
<host>myproxyhost</host>
<port>myproxyport</port>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<username>myusername</username>
<password>password</password>
<host>myproxyhost</host>
<port>myproxyport</port>
</proxy>
</proxies>
<servers></servers>
<mirrors></mirrors>
<profiles></profiles>
</settings>
Global Settings:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\path\mvn_repo</localRepository>
<pluginGroups></pluginGroups>
<proxies></proxies>
<servers></servers>
<mirrors></mirrors>
<profiles>
<profile>
<id>jboss-public-repository</id>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
</settings>
However I get 'Connection timed out' when I try to execute test goal.
This happens with both maven command line and M2Eclipse. What more settings do I require.
Maybe the proxy you are using requires NTLM authentication, which maven does not support.
You can try to use CNTLM:
http://cntlm.sourceforge.net/
JBoss repository has been moved in June 2011 causing many other users to experience problems like you describe. Most likely you need to change the URL in your pom.
For more details, refer to
How to configure jboss repository properly for my repository manager
and other answers listed as "Related" to above
JBoss wiki for maven users: Maven Getting Started - Users
PS. When doing the change, make sure to check all your poms that contain repository blocks because otherwise, broken JBoss URL may slip through these and kill your build

EclipseLink Maven Repository not working correctly?

I'm trying to get the EclipseLink libraries from the given Maven repositories.
I read the tips given in Where did the EclipseLink/Maven repository go to? on stackoverflow and tried to integrate the Maven repositories posted there into my settings.xml.
I added those links to my settings.xml and also tried my pom.xml but when trying to update the indexes I only get
Resource nexus-maven-repository-index.properties does not exist
from all of them.
Here's what I've configured in my settings.xml
<repositories>
<repository>
<id>eclipseLink</id>
<name>eclipseLink</name>
<url>http://www.gtlib.gatech.edu/pub/eclipse/rt/eclipselink/maven.repo/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
<repository>
<id>EclipseLink Repo</id>
<name>eclipseLink</name>
<url>http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
<repository>
<id>Eclipse 3</id>
<name>eclipseLink</name>
<url>http://eclipse.ialto.org/rt/eclipselink/maven.repo/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
I'm using the m2eclipse plugin for Eclipse to integrate the dependencies.
It seemed to me that in the Question mentioned above someone else is having the same issue in 2011, but it's not answered there.
Thanks for your help in advance.
I'm no maven, but I think the reason for this is that the repo is unindexed.
If you know what artifact you want, you can get it - but there's no index.

What repositories do you put in a generic pom file?

I am building a generic parent pom file for my projects.
In that file, I would like to have a list of most common Maven repositories, in order to have most dependencies available in the sub-projects (Jboss, Spring, etc.).
Here is this current pom:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.courtine</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<name>Parent</name>
<version>1.0</version>
<description>Common repositories</description>
<repositories>
<repository>
<id>javanet</id>
<name>Repository for Maven2</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>google</id>
<name>Google repository for Maven2</name>
<url>https://oss.sonatype.org/content/repositories/google-releases/</url>
</repository>
<repository>
<id>jboss</id>
<name>JBoss repository for Maven2</name>
<url>http://repository.jboss.org/maven2/</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
<repository>
<id>com.springsource.repository.libraries.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Library Releases</name>
<url>http://repository.springsource.com/maven/libraries/release</url>
</repository>
<repository>
<id>com.springsource.repository.libraries.external</id>
<name>SpringSource Enterprise Bundle Repository - External Library Releases</name>
<url>http://repository.springsource.com/maven/libraries/external</url>
</repository>
</repositories>
</project>
Is such a generic file listing common repositories a good idea?
Do you know other common public Maven repositories to put in such a generic pom file?
It is not a good idea to put repositories into a pom. Better use a Repository Manager like Nexus, Artifactory or Archiva.
In such kind of pom you should put things like default plugins with their appropriate revisions (pluginManagement) or dependencies which should be used (dependencyManagement).
Take a look for explanation into this. and take a look here how to setup this.
I have another option for doing what you want to do. You could using a profile in your settings.xml which reference all your repository for you (as an nexus/archiva will do).
I've posted something about his on my site.
Simply add this in your settings.xml:
<profile>
<id>my-repository</id>
<activation>
<!-- here we did not activat this profile by default -->
<activeByDefault>false</activeByDefault>
</activation>
<repositories>
<!-- list of standard repository -->
<repository>
<id>javanet</id>
<name>Repository for Maven2</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>google</id>
<name>Google repository for Maven2</name>
<url>https://oss.sonatype.org/content/repositories/google-releases/</url>
</repository>
<repository>
<id>jboss</id>
<name>JBoss repository for Maven2</name>
<url>http://repository.jboss.org/maven2/</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
<repository>
<id>com.springsource.repository.libraries.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Library Releases</name>
<url>http://repository.springsource.com/maven/libraries/release</url>
</repository>
<repository>
<id>com.springsource.repository.libraries.external</id>
<name>SpringSource Enterprise Bundle Repository - External Library Releases</name>
<url>http://repository.springsource.com/maven/libraries/external</url>
</repository>
<repository>
<id>intelligents-ia</id>
<name>Intelligents-ia Repository</name>
<url>http://intelligents-ia.com/maven2</url>
</repository>
</repositories>
</profile>
And you could build your project by adding -Pmy-repository on the command line:
mvn -Pmy-repository clean install
Or activate this profile by default by setting true on :
<activation>
<activeByDefault>true</activeByDefault>
</activation>

What are main/best Maven respositories to use? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What are the main/best Maven repositories to use that will include the majority of your open source Java package dependencies.
Also in what order should these be included? Does it matter?
This is the current setup in the project we are building:
MavenCentral
ObjectWeb
JBoss Maven2
and some snapshots (see below)
<repository>
<id>MavenCentral</id>
<name>Maven repository</name>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>objectweb</id>
<name>Objectweb repository</name>
<url>http://maven.objectweb.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jboss</id>
<name>JBoss Maven2 repository</name>
<url>http://repository.jboss.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>glassfish</id>
<name>Glassfish repository</name>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>
http://people.apache.org/repo/m2-snapshot-repository
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>ops4j.repository</id>
<name>OPS4J Repository</name>
<url>http://repository.ops4j.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>Codehaus Snapshots</id>
<url>http://snapshots.repository.codehaus.org/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
I would suggest using a Maven proxy like Archiva, Artifactory or Nexus and defining your repo list on the server side. The order matters only to the extent that the proxy server tries the proxied repos one by one and specifying a fringe repository as first will slow down the resolution of uncached artifacts (Artifactory allows you to specify whitelist and blacklist expressions for each proxied repo, which solves this problem)
Overall using your own repo gives you more control and reliable builds ('central' is often painfully slow). It also gives you a place to put your own artifacts and any non-free 3rd party artifacts.