Incorrect files added to WAR package with Gradle

I am using Gradle 1.5, and I am trying to adapt a WAR plugin to a dynamic Eclipse project.

When the WAR is exported by eclipse, it has xhtml files right at the root of the war file, and I managed to do this with Gradle.

But on my exported Gradle war I have xhtml files duplicated inside WEB-INF/classes along with my .class files

I only want to have .class files in this folder, but I did not find a way to do this

Here is the relevant part of my build.gradle file

 apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'war' webAppDirName = 'WebContent' sourceSets { main { java { srcDir 'src' } } } eclipse { // my eclipse plugin config.. } dependencies { // my dependencies config. } 

The only setting I made for the war plugin is to change webAppDirName to point to my WebContent folder.

Does anyone know how to determine what is included in the WEB-INF/classes ? I can't seem to figure this out.


EDIT I was able to remove duplicate .xhtml by translating the resources to the bin directory as follows:

 sourceSets { main { java { srcDir 'src' } resources { srcDir 'bin' } } } 

But I still have the wrong files in WEB-INF .

I even have this structure WEB-INF/classes/WEB-INF . I do not know why these folders are added to my classes directory, since they do not exist in my bin

I want the classes in my bin be in WEB-INF/classes and the static resources in my WebContent should be in the root of the WAR file

+4
source share
2 answers

By default, what is included in WEB-INF/classes is the result of a set of main source files (compiled classes and processed resources). Your build script declares an additional source directory ( src ) and saves the default resource directory. Do you have files under src/main/java or src/main/resources ?

+3
source

Eclipse uses the bin folder as the output folder, so it is likely that your files will be shuffled this way.

0
source

All Articles