Philip Crotwell wrote:
I am trying to create a task that will run java code that is built in
the current project. The user guide seems to indicate here:
http://gradle.org/0.8/docs/userguide/artifact_management.html#project_libraries
that the "default" configuration will be all runtime dependencies plus
archives. I assumed that this meant that the default java artifact jar
of my project would be part of "default" and so I could do something
like this:
task makeSodSite(dependsOn: jar) << { task ->
myArgs = '--run-once -p sod.prop'
ant.java(dir:'build/output',
classname:'edu.sc.seis.seiswww.MakeSite',
args:myArgs,
fork:true,
classpath:configurations.default.asPath,
Try:
classpath: sourceSets.main.runtimeClasspath.asPath
This will include build/main/classes, plus the dependencies in
configurations.runtime.
You should also change the dependsOn to
task makeSodSite(dependsOn: sourceSets.main.runtimeClasspath) << {
...
}
This will ensure everything in the runtimeClasspath has been built.
output:project.projectDir.path+'/build/output/makeSodSite.out')
}
But it doesn't work, with a NoClassDefFoundError. I put in a few
prints, like this:
println configurations.runtime.asPath
println configurations.archives.asPath
println configurations.default.asPath
and found that runtime and default seem to be identical and archives is empty.
Should the default artifact created by the java plugin be part of the
default configuration?
I think it should always include the jar. Oddly, if you add a project
dependency on the default configuration from another project, then it
does include the jar, but when you use it from the same project, it does
not include the jar.
Could you add a JIRA issue for this?
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email