i need to package a jar into my war file but this jar has to be exluded from test.
dependencies {
...
// weld-servlet is needed in tomcat but does not work in
// testing environment, because of conflicts with
// weld-se-shaded
compile 'org.jboss.weld.servlet:weld-servlet:2.2.+'
// for testing, a CDI container is needed
testCompile 'org.jboss.weld.se:weld-se-shaded:3.0.+'
...
}
i do not need the weld-servlet jar for compiling, i just need it in the war file.
is this possible?
[quote=“frankybooz, post:1, topic:10809, full:true”]i do not need the weld-servlet jar for compiling, i just need it in the war file.
is this possible?
[/quote]
Use the configuration runtime:
dependencies {
runtime 'org.jboss.weld.servlet:weld-servlet:2.2.+'
}
thx raffael for your answer.
unfortunately it doesn’t work that way either. ‘testRuntime’ uses the libs/classpaths from runtime, which i want to prevent. i’ve checked it with:
test {
configurations.testCompile.each { println "testCompile:" + it }
}
i’ve solved it with a little workaround using the war plugin and a new configuration:
configurations {
addWarArchive
}
war {
// additional libraries only for the war-archive.
classpath configurations.addWarArchive
}
dependencies {
...
addWarArchive 'org.jboss.weld.servlet:weld-servlet:2.2.+'
...
}
thanks again, and hope this helps others.