1

My Dependencie is built as a nar(which contains java files and a jni wrapper)

<dependency>
        <groupId>jni</groupId>
        <artifactId>jni</artifactId>
        <version>1.0.0-SNAPSHOT</version>
</dependency>

now If I do

mvn clean package

it says Could not resolve dependencies for project java:javatest:jar:1.0.0-SNAPSHOT: Could not find artifact jni:jni:jar:1.0.0-SNAPSHOT

the problem is, that in a project with nar-Packaging the output is named .nar instead of .jar so if I copy the jni.nar in my local repository(~/.m2/repository/jni/jni) and name it jni.jar it works fine.

Any Idea how I could solve that without manually renaming the file?

user2071938
  • 2,055
  • 6
  • 28
  • 60

1 Answers1

2

You probably need to tell Maven your dependency type is different:

<dependency>
        <groupId>jni</groupId>
        <artifactId>jni</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <type>nar</type>
</dependency>

NOTE: I'm guessing the type is "nar" here. Check the POM of the dependency to see what the actual type is.

Milen Dyankov
  • 2,972
  • 14
  • 25
  • The type is not necessarily related to the extension or the packaging. It is indeed `nar` here, [but because the plugin decided for that](https://github.com/maven-nar/nar-maven-plugin/blob/nar-maven-plugin-3.5.1/src/main/resources/META-INF/plexus/components.xml#L112-L115). – Tunaki Dec 21 '16 at 10:58
  • doesn't work either, In my understanding I would use that, If my project is also a NAR project which needs the shared library as a dependency? – user2071938 Dec 21 '16 at 11:01
  • @Tunaki Indeed! That's why I wrote I'm only guessing it's "nar". – Milen Dyankov Dec 21 '16 at 11:01
  • @user2071938 what "doesn't work" means? Are you getting the same error? Adding the type should correctly identify the artifact - which is what your original issue was. Note that how do you use that artifact is different story. – Milen Dyankov Dec 21 '16 at 11:06
  • 1
    got it! I need to add the `nar-maven-plugin` as well to use `nar`-dependencies – user2071938 Dec 21 '16 at 11:15