aram535
(Aram Mirzadeh)
March 31, 2015, 10:58pm
1
We’re publishing a multi-project’s Jars to artifactory. I would like to add source and javadoc to the upload as well.
However,
task sourcesJar ( type: Jar, dependsOn: classes ) {
classifier 'sources'
from sourceSets.main.allJava
}
publishing {
publications {
mavenJava (MavenPublication) {
from components.java
artifacts souceJar
}
}
}
// publish what was tagged above 'mavenJava' is the container name
artifactoryPublish {
publications(publishing.publications.mavenJava)
}
Produces:
Could not find property 'mavenJava' on Publication container.
I believe you want to pass the publications you want published as strings.
artifactoryPublish {
publications 'mavenJava'
}
aram535
(Aram Mirzadeh)
April 1, 2015, 12:44am
3
Well without the “artifacts sourceJar” it works fine as is.
I did try switching it a passable text, and the result was:
Publication named 'mavenJava' does not exist for project ':' in task ':artifactoryPublish'
So I switched it back. I’m not sure how mavenJava is filled but it’s an array of all jar files from the subprojects.
Here is the full block:
if(project.name.endsWith("-ws")) {
apply plugin: 'com.github.jacobono.wsdl'
....
compileJava.dependsOn wsimport
} else {
apply plugin: 'maven-publish'
task sourcesJar ( type: Jar, dependsOn: classes ) {
classifier 'sources'
from sourceSets.main.allJava
}
publishing {
publications {
mavenJava (MavenPublication) {
from components.java
artifacts sourceJar
}
}
}
// publish what was tagged above 'mavenJava' is the container name
artifactoryPublish {
publications(publishing.publications.mavenJava)
}
}
It should be artifact sourceJar
not artifacts sourceJar
.
mavenJava (MavenPublication) {
from components.java
artifact sourceJar
}
aram535
(Aram Mirzadeh)
April 1, 2015, 10:27am
5
Change made, same error … Could not find property ‘mavenJava’ on Publication container.
I’m not certain why you are getting this error. I’m not particularly familiar with this plugin. Can you try configuring the plugin extension rather than the task?
artifactory {
publish {
publications 'mavenJava'
}
}
aram535
(Aram Mirzadeh)
April 1, 2015, 4:47pm
7
Must have been a gradle caching issue.
I added --recompile-scripts --rerun-tasks --refresh-dependencies and it now works.
Thank you very much.