I have defined a task for updating a netbeans project with it's build
dependencies extracted from gradle. The issue is that I would like to
also download source and javadoc jars (if they exist) for dependencies
when updating the netbeans dependencies and libraries. That way the
source code will be available in netbeans when using goto source.

I have provided the task below. Also, please enlighten me if I am
using bad groovy coding patterns here, it's still a pretty fresh
language to me.

task nbdep(dependsOn: [configurations.compile,configurations.testCompile]) << {
  nbprops = new java.util.Properties()
  nbprops.load(new FileInputStream("lib/nblibraries.properties"))
  [configurations.compile,configurations.testCompile].each { c ->
c.dependencies.each { d ->
    
nbprops.setProperty("libs.${d.name}_${d.version}.classpath","${c.fileCollection(d).collect
{ File f -> f.absolutePath }.join(":")}")
  }}

  nbprops.store(new FileWriter("lib/nblibraries.properties"),
"Generated by gradle")

  projectprops = new java.util.Properties()
  projectprops.load(new FileInputStream("nbproject/project.properties"))
  cp_compile = { d -> "\${libs.${d.name}_${d.version}.classpath}" }
  projectprops.setProperty("javac.classpath",
configurations.compile.dependencies.collect(cp_compile).join(":"))
  projectprops.setProperty("javac.test.classpath",
"\${javac.classpath}:\${build.classes.dir}:"+configurations.testCompile.dependencies.collect(cp_compile).join(":"))
  projectprops.store(new FileWriter("nbproject/project.properties"),
"Generated by gradle")
}

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

    http://xircles.codehaus.org/manage_email


Reply via email to