ptornagh wrote:
> I'm currently porting and our current build system to gradle and have the
> following situation:
>
> One of the projects contains two source directories (2 packages) and
> produces two jar files (one for each source directory).
>
> example:
> com.mycompany.package1
> com.mycompany.package2
>
>
Do these packages share the same parent directory? I'm going to assume
they do.
> I want gradle to produce 1 jar for each package...how can I do?
>
> I know that ideally these would be two seperate projects (or subprojects)
> but I would like to avoid that option at the moment.
>
>
You don't have to split them into separate projects if you don't want.
It's not necessarily the best way to go if the 2 sets of source are
closely related. Gradle quite happily deals with projects that produce
more than one artifact.
There's a couple of approaches to your problem. One approach is to
compile everything in one go, and generate separate jars. Assuming all
source is under 'src/main/java', you really only need to do:
jar {
include 'com/mycompany/package1/**'
}
task otherJar(type: Jar) {
from sourceSets.main.classes
include 'com/mycompany/package2/**'
// you will need something to distinguish this jar from the other,
one of:
// baseName = 'myotherjar'
// classifier = 'someclassifier'
// customName = 'myotherjar.jar'
}
The other approach is to add a source set for each of the packages. This
is useful if the 2 packages need to be compiled with different compile
classpaths, for example.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email