I have this dependencies tree in my gradle.
I have included axis2-xmlbeans-1.6.1
in dependencies section. This makes my project also include servlet-api-2.3
which I don't want.
I have tried to remove it from dependencies but it does not work.
dependencies {
compile('org.apache.axis2:axis2-xmlbeans:1.6.1'){
//exclude module: 'javax.servlet:servlet-api:2.3'
exclude group: 'javax.servlet' , module: 'servlet-api'
}
...
}
Result of gradle dependencies
:
+--- org.apache.axis2:axis2-xmlbeans:1.6.1 [default]
| +--- org.apache.axis2:axis2-codegen:1.6.1 [compile,master,runtime]
| | +--- org.apache.axis2:axis2-kernel:1.6.1 [compile,master,runtime]
| | | +--- org.apache.ws.commons.axiom:axiom-api:1.2.12 [compile,master,runtime]
| | | | +--- jaxen:jaxen:1.1.6 [compile,master,runtime]
| | | | +--- .....
| | | +--- javax.servlet:servlet-api:2.3 [compile,master,runtime]
Do you know the solution?
Your example is not good enough to replicate the issue. I ran gradle dependencies
on this script:
apply plugin: "java"
repositories {
mavenCentral()
}
dependencies {
compile('org.apache.axis2:axis2-xmlbeans:1.6.1') {
//exclude module: 'javax.servlet:servlet-api:2.3'
exclude group: 'javax.servlet', module: 'servlet-api'
}
}
And there is no servlet-api
. It's likely that the dependency gets in from a different configuration (maybe master
, it looks like your custom configuration). You can try to eliminate it from there, or you can remove a dependency from all configurations:
configurations {
master
all*.exclude group: 'javax.servlet', module: 'servlet-api'
}