Cool, thanks for sharing.

On Mon, Aug 8, 2011 at 5:08 PM, Ruediger Schobbert <
[email protected]> wrote:

> Ups, in my code I sent the wrong type value (did too much testing :-) ), it
> should be:
>
>
> 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 = 'source'
>
>        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'
>
>
>
>
>
> Am 08.08.2011 17:02, schrieb Ruediger Schobbert:
>
>  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<http://xircles.codehaus.org/manage_email>
>>
>>
>>
> --
> emesit GmbH & Co. KG
>  Henkestr. 91
>  91052 Erlangen
> Handelsregister:
>  HRA 8321, Fürth/Bayern
> Komplementär:
>  emesit Beteiligungs-GmbH
>  HRB 10201, Fürth/Bayern
> Geschäftsführer:
>  Ralph Mayr, Rüdiger Schobbert
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe from this list, please visit:
>
>   
> http://xircles.codehaus.org/**manage_email<http://xircles.codehaus.org/manage_email>
>
>
>


-- 
Szczepan Faber
Principal engineer@gradleware
Lead@mockito

Reply via email to