Browse Source

Fixing issue when publishing source/javadoc to maven central

pull/1/head
Justin Ryan 13 years ago
parent
commit
1cbb4d6dbe
  1. 23
      gradle/convention.gradle

23
gradle/convention.gradle

@ -14,23 +14,40 @@ subprojects { project ->
task sourcesJar(type: Jar, dependsOn:classes) { task sourcesJar(type: Jar, dependsOn:classes) {
from sourceSets.main.allSource from sourceSets.main.allSource
classifier 'sources'
extension 'jar'
} }
task javadocJar(type: Jar, dependsOn:javadoc) { task javadocJar(type: Jar, dependsOn:javadoc) {
from javadoc.destinationDir from javadoc.destinationDir
classifier 'javadoc'
extension 'jar'
} }
configurations.add('sources') configurations.add('sources')
configurations.add('javadoc') configurations.add('javadoc')
configurations.archives {
extendsFrom configurations.sources
extendsFrom configurations.javadoc
}
// When outputing to an Ivy repo, we want to use the proper type field
gradle.taskGraph.whenReady {
def isNotMaven = !it.hasTask(project.uploadMavenCentral)
if (isNotMaven) {
def artifacts = project.configurations.sources.artifacts
def sourceArtifact = artifacts.iterator().next()
sourceArtifact.type = 'sources'
}
}
artifacts { artifacts {
sources(sourcesJar) { sources(sourcesJar) {
type 'source' // Weird Gradle quirk where type will be used for the extension, but only for sources
classifier 'sources' type 'jar'
} }
javadoc(javadocJar) { javadoc(javadocJar) {
type 'javadoc' type 'javadoc'
classifier 'javadoc'
} }
} }

Loading…
Cancel
Save