HavenNo7
HavenNo7

Reputation: 107

Gradle + war = Wrong war content

I am using Gradle, but the output war file (on /build/libs/project-version.war) has only the WebContent information.

Here's how I´ve set up my build.gradle file:

//others
apply plugin: "war"


//repos and dependencies

webAppDirName = 'WebContent'

sourceSets {
    main {
        java {
            srcDir 'src'
        }

        resources {
            srcDir 'src'
        }
    }
}

And when I run gradle build command the WAR content is:

enter image description here

Can you guys help me out setting up the correct WAR ? Thanks

Upvotes: 1

Views: 1462

Answers (1)

HavenNo7
HavenNo7

Reputation: 107

Actually, the WAR Content is correct.

If you are going to build a WAR you need to specify this for it to build correctly:

webAppDirName = 'WebContent'

sourceSets {
    main {
        java {
            srcDir 'src'
        }

        resources {
            srcDir 'src'
        }
    }
}

Hope this helps.

Upvotes: 2

Related Questions