I have a utility project that uses gradle to create JAR artifacts. When creating a JAR artifact, I use classifierthe Jar task property explained here . The code I use in my build.gradle file is:
def artifactClassifier = project.hasProperty('classifier') ? classifier : "dev"
jar {
classifier = artifactClassifier
}
I saw that the JAR is generated as expected ( myutils-1.0-test.jar), and I am running the next gradle build.
$ gradle clean build -Pclassifier=test
Now I tried to install this artifact in the local M2 repository using the following command:
$ mvn:install install-file -Dfile=/path/to/myutils-1.0-test.jar -DgroupId=my.group -DartifactId=myutils -Dversion=1.0 -Dclassifiers=test
, M2, , JAR : ~/.m2/repository/my/group/myutils/1.0/myutils-1.0.jar. test . :
<dependency>
<groupId>my.group</groupId>
<artifactId>myutils</artifactId>
<version>1.0</version>
<classifier>test</classifier>
</dependency>
, maven . classifier maven . gradle. , gradle ( @jar, .
ext {
myutils.version = "1.0"
}
compile "my.group:myutils:${myutils_version}:test@jar"
:test@jar gradle .
gradle v2.3 Maven v3.3.1
- ? - ?