I have a multiproject project with a core project ace2
that is dependened on; it has dependencies. I cannot seem to get the transitive dependencies to NOT to end up in the other project dataentry2
, War's web-inf\lib
directory even when using a provided
configuration (yes I want the compile
etc.. dependencies included). More than that, the dependencies marked testCompile
/ testRuntime
also end up there. So it seems that I am missing something significant here.
The Master Project:
allprojects {
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
repositories {
mavenCentral()
}
}
project(':ace2') {
configurations {
provided
}
sourceSets {
main.compileClasspath += configurations.provided
test.compileClasspath += configurations.provided
test.runtimeClasspath += configurations.provided
}
eclipse {
classpath {
//Add the provided configuration items to the Eclipse classpath
plusConfigurations += [ configurations.provided ]
//But don't export them
noExportConfigurations += [ configurations.provided ]
}
}
dependencies {
compile('org.apache.poi:poi:3.11')
compile('org.apache.poi:poi-ooxml:3.11')
....
provided "org.apache.tomcat:tomcat-catalina:8.0.22"
....
testCompile('junit:junit:4.12')
}
}
project(':dataentry2') {
apply plugin: 'war'
dependencies {
compile project(':ace2')
}
}
I also tried everything that is inside the ace2
project out in ace2's own build.gradle
.
If I can solve the 'noExportConfigurations should be honoured' problem then I could add testCompile
, testRuntime
to noExportConfigurations
.
Any ideas why noExportConfigurations
(or whatever it is) isnt working for me?
I am thinking that the location of the noExportConfigurations
inside the :ace2
project is a different scope to the eclipse in another project. I tried to move this outside into the top-level of the master project's build.gradle
but I don't know the syntax. The following DOES NOT WORK:
noExportConfigurations += [ project(':ace2').configurations.provided ]
- OS: Windows 8
- Java: 1.8
- Gradle (command-line): 2.4
- Eclipse: STS 3.6.4 (Eclipse 4.4.2)
- Eclipse Gradle: Gradle IDE 3.6.4.201503050952-RELEASE org.springsource.ide.eclipse.gradle.feature.feature.group Pivotal Software, Inc.
Thanks Andreas for your comments. I have created a bare bones example at https://github.com/oehm-smith/gradleMultiprojectProvided that doesnt work for me.
Following your comments I did an Eclipse > Right-click in project area > Export > War choosing 'apir' web project and some destination file. This .war contains the tomcat and junit jars.
Could you try that out - there is a https://github.com/oehm-smith/gradleMultiprojectProvided/blob/master/README.md
Gradle Multiproject with a Provided scope / configuration. Running war from the CL creates a .war with no jars marked with 'provided'. But run Eclipse > Run On Tomcat and the provided and test jars go to webinf/lib.
1. cd master
2. gradle war
3. jar tvf ../apir/build/libs/apir.war | grep jar
4. Observe no 'tomcat' jars are in the war
Now do in Eclipse:
1. In Eclipse with Gradle plugin ...
right-click > import > gradle and select the master project > build > select > ok
2. Choose 'apir' project > right-click > run on server > piviol tc Server is fine to use (or Tomcat)
3. Choose 'pivotal tc Server ' > Browse Deployment Location
4. Observe there ARE 'tomcat' jars in the wtpwebapps/apir/WEB-INF/lib directory