I'm trying to name the artifact that gets built by gradle. Look at this build.gradle
:
archivesBaseName='this_is_ignored'
apply plugin: 'groovy'
archivesBaseName='this_is_also_ignored'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.+'
}
I also tried in gradle.properties
:
archivesBaseName=`this_is_ignored_too`
In every case ./gradlew build
generates a .jar file based on the folder where the project resides (which as I understand it is project.name
, I was just hoping to override that with archivesBaseName
).
In other words, I want:
~/gradle-helloworld > ./gradlew build
to generate this_is_ignored.jar
, but it's generating gradle-helloworld.jar
instead.
Any ideas?
(Turning Peter's comment into a CW answer.)
If you set archivesBaseName
before applying the plugin, you'll introduce a dynamic property (which gives a deprecation warning). This dynamic property will then shadow the one introduced by the plugin, which is why the second assignment doesn't have the desired effect either. The solution is to only set the property after applying the plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With