Hello
In a multi-project environment, I have a project1 which is a java project
defined this way:
// project1
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile 'org.json:json:20090211'
runtime 'log4j:log4j:1.2.16'
}
Then I have another project (project2) which is not a java project at all
defined this way:
// project2
configurations {
lib
}
dependencies {
lib project(':project1')
}
Project p1 = findProject(':project1')
task task3(dependsOn: p1.jar) << {
display(configurations.lib)
display(p1.configurations.runtime)
display(p1.configurations.archives)
}
private void display(configuration)
{
println "### ${configuration}"
configuration.resolve()?.each {
println "r: ${it} => ${it.exists()}"
}
configuration.artifacts?.file?.each {
println "a: ${it} => ${it.exists()}"
}
}
If I run 'gradle clean task3', (from the root project) I get the following
output:
:project1:clean
:project1:compileJava
:project1:processResources
:project1:classes
:project1:jar
:project2:task3
### configuration ':project2:lib'
r: /Users/ypujante/scratch/gradle-depend/project1/build/libs/project1.jar =>
true
### configuration ':project1:runtime'
r: /Users/ypujante/.gradle/cache/log4j/log4j/bundles/log4j-1.2.16.jar =>
true
r: /Users/ypujante/.gradle/cache/org.json/json/jars/json-20090211.jar =>
true
### configuration ':project1:archives'
a: /Users/ypujante/scratch/gradle-depend/project1/build/libs/project1.jar =>
true
What I am really trying to do is the following:
* project2 needs to have access to all the dependencies expressed in the
'dependencies' section (like if it was a java project)
* in my task (in project2) I need to have access to all the jar files (the
one produced by project1:jar as well as its compile and runtime dependencies
and recursively) and also that it needs to obviously run the project1:jar in
order to get the information.
I can see from the output of my task3 that I have a way to get this
information but it seems somewhat clunky.. Also what I would like is that
project2.configurations.lib contains the union of
project1.configurations.runtime and project1.configurations.archives
I suppose ideally I would like my code to look like:
configurations {
lib
}
dependencies {
lib project(':project1')
}
task task3(dependsOn: configurations.lib) << {
display(configurations.lib)
}
which would 'magically' compile project1 and make all artifacts
(transitively/recursively) available in the lib configuration
Thanks
Yan Pujante
Note: this is for my org.linkedin.cmdline plugin (I need to copy all jar
files of my cmdline in the lib folder)
--
View this message in context:
http://gradle.1045684.n5.nabble.com/How-to-express-jar-dependency-from-a-non-jar-project-tp3281540p3281540.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email