Hi, I’m new to Gradle and am trying to port an existing ant build system to Gradle. In a few of our sub projects we need to use JNI to access legacy code. In our ant build system we would put pure java code in the WAR and the JNI code in a separate jar that would be deployed to the lib folder of our application server (Jboss 6.10). I am trying to do the same thing with Gradle, but I am running into some trouble. When I do the standard exclude:
// This project depends on 2 without JNI and one that has JNI
dependencies {
compile project(':project1')
compile project(':project2')
// This jar contains JNI and must not be in the WAR
providedCompile (project(path: ':projectWithNative', configuration: 'nativeJar')){ transitive = false }
compile 'org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:1.0.0.Final'
}
// Attempt to exclude class files that must not be in WEB-INF/classes
// This seems to break providedCompile functionality in the war plugin
war {
classpath = configurations.runtime
webInf {
into('classes') {
from sourceSets.main.output
exclude('**/*Jni.class')
exclude('**/LoadLibrary.class')
}
}
}
The classes are removed from the war file BUT unfortunately, the JAR file from the providedCompile is included in the WAR file.
If I remove the classpath statement, then the providedCompile properly excludes its JAR, but the offending classes return.
In the end I need all the JNI related classes and JARs excluded from the WAR. How do I exclude both from the WAR file?
I am using gradle 1.1 on both win64 and Linux -Thanks