I just started using Gradle and so far I think it is a great tool but currently I'm having a problem to generate a web application which works with eclipse.
My folders structure looks like this:
/WebGradle
/src
/main
/java
/resources
/webapp
/WEB-INF
/test
My build.gradle file:
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
sourceCompatibility = 1.6
repositories {
mavenCentral()
}
dependencies {
compile 'org.springframework:spring-webmvc:4.0.6.RELEASE'
providedCompile 'javax.servlet:servlet-api:2.5'
}
My problem is that, when I run gradle eclipse
the resulting .classpath file is missing the webapp folder, thus when I import the project in eclipse it tells me something is missing.
Am I doing something wrong?
Thanks in advance!
I was generating my war file using
gradle war
directly from eclipse and the resulting war file didn't contained anything that I placed inside the webapp folder, so I thought the problem was the webapp folder was not being properly referenced (I was wrong).After some tests, I find out that I needed to run
gradle build
and thengradle war
and my war file was properly generated.If I run
gradle war
from command line the war file is generated without a single problem, I guess it automatically does a build before generating the war.