I have a package which is a JNI wrapper around native code and is therefore platform dependent. I want to create a platform specific jar using os-maven-plugin. The relevant part of my pom is as follows:
<groupId>foo.bar.baz</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.1</version>
</extension>
</extensions>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<classifier>${os.detected.classifier}</classifier>
</configuration>
</plugin>
</plugins>
// ...
After running mvn clean install
, it seems the artifact is built appropriately:
$ ls /Users/erip/.m2/repository/foo/bar/baz/project/0.0.1-SNAPSHOT
_remote.repositories project-0.0.1-SNAPSHOT-osx-x86_64.jar
maven-metadata-local.xml project-0.0.1-SNAPSHOT.pom
however, when I add this dependency to my gradle file…
repositories {
// ...
mavenLocal()
}
dependencies {
// ...
compile 'foo.bar.baz:project:0.0.1-SNAPSHOT:osx-x86_64'
}
and try to build, gradle says it can’t find the file:
$ ./gradlew clean build
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find foo.bar.baz:project:0.0.1-SNAPSHOT.
Searched in the following locations:
...
- file:/Users/erip/.m2/repository/foo/bar/baz/project/0.0.1-SNAPSHOT/project-0.0.1-SNAPSHOT.pom
Required by:
project :
It looks in an existing pom, but fails to resolve the jar, so why can't gradle find this dependency?