Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What POM dependency would allow Maven to find this JAR?

I'm trying to import Mockito into a Maven Java project. In order to build, I need to use artifacts in my companies Maven repository.

Fortunately, I do find a Mockito artifact in the repository:

[my-company]/org/mockito/mockito-all/1.8.0/mockito-all-1.8.0-jvm15.jar.

If I add the following dependency to my POM:

<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
     <version>1.8.0-jvm15</version>
</dependency>

then maven tries to find the jar in a non-existent directory:

[my-company]/org/mockito/mockito-all/1.8.0-jvm15/mockito-all-1.8.0-jvm15.jar

If I remove the -jvm15, like this:

<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
     <version>1.8.0</version>
</dependency>

then (naturally) maven tries to find the a nonexistent jar in the right directory:

[my-company]/org/mockito/mockito-all/1.8.0/mockito-all-1.8.0.jar

Is there a way to specify the path that works around the seemingly non-standard naming in my companies repository? I need the artifact in our internal repository.

like image 798
Eric Wilson Avatar asked May 10 '11 16:05

Eric Wilson


2 Answers

The part after the version is called the classifier. Try this:

<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
    <version>1.8.0</version>
    <classifier>jvm15</classifier>
</dependency>
like image 171
Cem Catikkas Avatar answered Oct 08 '22 02:10

Cem Catikkas


Add a classifier tag -

<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-all</artifactId>
     <version>1.8.0</version>
     <classifier>jvm15</classifier>
</dependency>
like image 28
Biju Kunjummen Avatar answered Oct 08 '22 04:10

Biju Kunjummen