开发者

What POM dependency would allow Maven to find this JAR?

I'm trying to import Mockito into a Maven 开发者_StackOverflowJava 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.


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>


Add a classifier tag -

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜