Steve Ebersole wrote:
I am curious whether Gradle offers a solution to the problem of
compiling against different JDKs but including the compiled classes into
a single jar.
I assume the different JDKs would need to be isolated into different
modules, at least that's how I best see this operating with IDEs. So
then is it possible to have 2 modules that depend on a 3rd for
compilation but where classes are bundled into the artifact from that
3rd?
Yes. Though, it is complicated a bit by the fact that inter-project (ie
inter-module) dependencies use the jar file by default. So the 2
projects would depend on the jar from the 3rd, which would in turn
depend on the classes from the 2 projects.
This isn't a big deal, you could do something like:
project 1 & 2
dependencies {
compile { project('project3').sourceSets.main.classes }
}
project 3:
jar {
from { project('project1').sourceSets.main.classes }
from { project('project2').sourceSets.main.classes }
}
You could also do a similar thing with some custom configurations.
Some other options:
- Add a second jar file to project 3 which contains all the classes.
- Add a fourth project which aggregates the 3 other projects.
- Use a single project, and use a source set for each java version.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email