Why is Gradle being ignored by groupId / artifactId?
Here is my Gradle build:
apply plugin: 'groovy'
apply plugin: 'maven'
group = 'myorg'
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.3.3'
compile 'org.apache.httpcomponents:httpclient:4.3.5'
compile 'org.slf4j:slf4j-api:1.7.5'
testCompile 'junit:junit:4.11'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task createPom << {
pom {
project {
groupId group
artifactId "myapp"
version version
}
}.writeTo("build/libs/pom.xml")
}
And the assembly call I'm using:
gradle clean build groovydoc sourcesJar createPom -Pversion=SNAPSHOT
When I ran this:
- The POM file is created with
groupId
,artifactId
andversion
, everything renders correctly inside the XML; but - The resulting JAR name is whatever folder the project resides in. For example, if the name of my project root is "fizz" and the above build file is in
fizz/build.gradle
, then calling build above will outputfizz-<version>.jar
(where<version>
is whatever value I specify on the command line) If I now rename the directoryfizz/
tobuzz/
and re-run the same assembly call will be createdbuzz-<version>.jar
.
My question is, how / where (which file) am I hard-coded groupId
and artifactId
internally so that myapp-<version>.jar
is generated, regardless of the name of the project root?
+3
source to share