On 29/12/09 4:25 AM, aappddeevv wrote:
How can you attach the sources to the compile configuration so that the
eclipse plugin adds the sources (via the sourcepath attribute) to the proper
jar entry in the .classpath file?


You can't yet. The JIRA issue for this is: http://jira.codehaus.org/browse/GRADLE-238


This should work (it's not pretty) :

     task src(type: Copy) {
         from {
             // Copy the compile configuration and replace the main
artifact with the source artifact for each dep
             def conf = configurations.compile.copyRecursive { it
instanceof ExternalModuleDependency }
             conf.dependencies.each { dep ->
                 dep.artifact {
                     group = dep.group
                     name = dep.name
                     version = dep.version
                     classifier = 'sources'
                     type = 'jar'
                 }
             }
             conf
         }
         into 'lib/source'
         // Add this to clean the target dir first. For Gradle 0.9, you'd
use the Sync task instead
         doFirst {
             ant.delete(dir: destinationDir)
         }
     }




--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to