I am trying to figure out exactly how I can specify that a different JDK
(different from the one used to launch gradle) be used for the javac
tasks for a given (sub)project.  Any pointers?

On Wed, 2009-10-07 at 10:14 -0500, Steve Ebersole wrote: 
> The difficulty here is that this does not fit well with IDEs (at least
> not the IDEs with which I am familiar).  Most (all?) IDEs want to
> associate a JDK with each module/project.  So the approach of using
> multiple modules/projects here fits best IMO because it can be used in
> gradle as well as in an IDE.
> 
> But I do love that gradle gives you this kind of flexibility.
> 
> 
> On Wed, 2009-10-07 at 08:39 +1100, Adam Murdoch wrote:
> > You don't necessarily need to use multiple projects if you don't want 
> > to. A single project can have multiple groups of source directories, 
> > known as source sets. Each source set has its own compile task which you 
> > can configure independently - including which javac to use.
> > 
> > So, given a single project with a layout something like:
> > src/common/java
> > src/jdbc3/java
> > src/jdbc4/java
> > 
> > You could define a source set for each of these source directories, and 
> > assemble the classes into a single jar. Here is a (complete) example:
> > 
> > sourceSets {
> >     common // default source dir is 'src/common/java'
> >     jdbc3 {
> >         compileClasspath = common.classes + common.compileClasspath
> >     }
> >     jdbc4 {
> >         compileClasspath = common.classes + common.compileClasspath
> >     }
> > }
> > 
> > compileJdbc3Java {
> >     fork(executable: 'path-to-java5')
> > }
> > 
> > compileJdbc4Java {
> >     fork(executable: 'path-to-java6')
> > }
> > 
> > jar {
> >    from sourceSets.common.classes
> >    from sourceSets.jdbc3.classes
> >    from sourceSets.jdbc4.classes
> > }
> 
-- 
Steve Ebersole <[email protected]>
Hibernate.org


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

    http://xircles.codehaus.org/manage_email


Reply via email to