Reputation: 21596
I am using gradle in order to upload jar to artifactory. I managed to do it however I am trying to change the jar filename but it doesnt really let me.
I am using shadowJar to package. this is how I do it:
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
classifier = ''
baseName = 'com.mycompany.app-all'
manifest {
attributes 'Main-Class': 'com.mycompany.app.main.starter'
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.shadow
groupId 'com.mycompany'
artifactId "app"
version "${build_version}"
}
}
}
Now if build_version=2.1 than the dirs on artifactory will look like this:
http://repo.address:8081/artifactory/libs-release-local/com/mycompany/app/2.1/app-2.1.jar
I would like to keep the folder structure but change the jar filename(as defined in shadowJar)
and to have it this way:
http://repo.address:8081/artifactory/libs-release-local/com/mycompany/app/2.1/com.mycompany.app-all.jar
any idea?
Upvotes: 3
Views: 4161
Reputation: 41
As mentioned in the above answer, to modify the jar name to be published to artifactory , just adding the below to publishing worked for me.
artifactId = 'ChangedJarName'
Upvotes: 0
Reputation: 23647
The Jar task default naming convention is
[baseName]-[appendix]-[version]-[classifier].[extension]
If you set just the basename, the remaining values get appended to it. To override, set archiveName
instead of baseName
shadowJar {
...
archiveName = 'com.mycompany.app-all'
...
}
To change naming on what artifactory is publishing:
publishing {
publications {
mavenJava(MavenPublication) {
from components.shadow
groupId 'com.mycompany'
artifactId 'com.mycompany.app-all' //<-- changed here
version '' // and here
}
}
}
Upvotes: 1