I am creating a library, a new feature in Spring 4 allows the user of the library some neat benefits. However, I also want to support spring 3.
I am having some difficulties when setting this up correctly in Intellij using gradle.
I created two gradle sub projects mylib
and mylib-spring3
. I let mylib
be dependent on spring 4
while mylib-spring3
is dependent on spring 3
. Since mylib-spring3
is just some helper classes for spring 3
it must also depend on mylib
. In other words:
mylib/build.gradle
dependencies {
compile 'org.springframework:spring-core:4.1.5.RELEASE'
}
mylib-spring3/build.gradle
dependencies {
compile 'org.springframework:spring-core:3.2.13.RELEASE'
compile(project(':mylib')) { transitive = false }
}
This works in gradle, but it does not work when imported to Intellij because Intellij exports mylib
's spring 4
dependency. The button for disabling the export is only for compile-time. I still get spring 4
on mylib-spring3
's runtime classpath.
Any suggestions on how to structure this would be greatly appreciated.