views:

584

answers:

1

Hi,

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.

+1  A: 

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&lt;/url&gt;
        <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&lt;/url&gt;
        <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&lt;/url&gt;
        <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&lt;/url&gt;
        <layout>default</layout>
    </pluginRepository>
</pluginRepositories>
Taylor Leese
Putting this in settings.xml might be better, assuming one wants the same repositories in all the projects they are working with.
sal
This would require the individual developers to update their settings.xml in their .m2 folder. The benefit of having them defined in the pom.xml is that you can checkout from SVN and build with no additional steps. I also wasn't sure if the m2eclipse plugin would be able to list the third party dependencies appropriately unless it was in the pom.xml.
Taylor Leese