A while back I found the hint how to upload sources and javadocs on this
mailinglist.
I don' know the exact solution anymore, but fact was, that it kind of worked
but I always had
the source and javadoc zips as dependency in all projects depending on that
particular library.
So while doing the investigation on how to upload multiple jars to an ivy repository, I also found
out more about this issue.
As a side note:
The eclipse plugin seems to be very picky about the extension of the archive. So just by changing
the extension of the source archive from jar to zip, the sourcepath attribute in my .classpath
(which points to the sources of a library) disappears.
By looking at other ivy.xml files where it worked correctly I found out that:
- the source (and javadoc) archive should not be in the archives configuration, otherwise your
javadoc and source archives are downloaded as dependencies
- the classifier can either be set in the jar task or in the artifacts section
- the classifier must be 'sources'
- the type must be set in the artifacts section
- the type must be 'source' not 'sources', this is very important since you tend to write it like
the classifier
- as already stated the extension cannot be changed to 'zip'
So a solution that works looks like this:
configurations {
sources
javadocs
}
task packageJavadocs (type: Jar, dependsOn: 'javadoc') {
from project.javadoc.destinationDir
classifier = 'javadoc'
}
task packageSources (type: Jar) {
from project.sourceSets.main.allSource
classifier = 'sources' // either here or in artifacts block
}
artifacts {
sources (packageSources) {
type = 'sources'
classifier = 'sources' // either here or in packageSources
}
javadocs (packageJavadocs) {
type = 'javadoc'
classifier = 'javadoc'
}
}
task 'uploadSources'(type:Upload) {
repositories {
add uploadArchives.repositories.iterator().next()
}
configuration = configurations.sources
}
task 'uploadJavadocs'(type:Upload, dependsOn:'uploadSources') {
repositories {
add uploadArchives.repositories.iterator().next()
}
configuration = configurations.javadocs
}
project.uploadArchives.dependsOn 'uploadJavadocs'
Cheers,
RĂ¼diger.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email