I feel like I am missing something obvious here, but I can't seem to find it.
I have a project, where I want my package structure like so
/src
/webapp
/webapp-package-1
/webapp-package-2
/iface
/iface-package-1
/iface-package-2
I want to define a task that packages up the classes for iface and makes it into a jar. So I followed the user guide here: http://www.gradle.org/0.8/docs/userguide/userguide_single.html#configureSourceSet (I am using version 0.8).
I now have this,
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
intTest {
java {
srcDir 'src/iface/'
}
resources {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
}
resources {
srcDir 'src'
}
}
}
task intTestJar(type: Jar, dependsOn: intTestClasses) {
from sourceSets.intTest.classes
}
And can verify that the classes in intTest
are being built appropriately in /build/classes/intTest
. However, trying to invoke the intTestJar
always gives me this warnin开发者_开发问答g:
[ant:jar] Warning: skipping jar archive C:\workspace\foo\build\libs\foo-1.0.jar because no files were included.
I don't understand this, because the classes are being created successfully. Also, the full build task creates the entire jar successfully.
Ideas?
This solution appears to work with the latest version of Gradle(0.9.2). I ran the intTestJar task exactly as shown above(adding the java plugin of course) on this file tree:
└── iface
└── ifacePackageOne
├── Test.java
└── testFile.txt
and here's the resulting jar structure:
├── META-INF
│ └── MANIFEST.MF
└── iface
└── ifacePackageOne
├── Test.class
└── testFile.txt
So the short answer - try a newer version of Gradle. http://gradle.org/
精彩评论