Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you import a Maven dependency from Sonatype.org?

I'm trying to import Robolectric into my Maven project, with:

        <dependency>
            <groupId>com.pivotallabs</groupId>
            <artifactId>robolectric</artifactId>
            <version>1.2-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>

The artifact is listed here:

https://oss.sonatype.org/index.html#nexus-search;quick~robolectric

I tried including:

<repositories>
    <repository>
        <id>oss-sonatype</id>
        <name>oss-sonatype</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

as suggested from this post, but it doesn't resolve robolectric.

like image 968
Christopher Perry Avatar asked Dec 19 '12 04:12

Christopher Perry


1 Answers

This should work although you should really install a repository manager like Sonatype Nexus and proxy the oss snapshot repository.

In your case the problem might be that it did not find it previously and that fact is cached in your local repository. To force Maven to check agagin use the -U flag so e.g. run

mvn -U clean install
like image 170
Manfred Moser Avatar answered Oct 23 '22 10:10

Manfred Moser