Build Custom war including only specific packages for grails application


(Meha Pandey) #1

HI All,

I have an existing grails 3.X project which is built using Gradle. I have added some more packages and need to generate a new war with only specific packages. I am writing a new build.gradle with all other dependencies but only specific packages.

war {
archiveName “edge_api.war”
}

task edgeWar(type: war, dependsOn: war){
include(‘com/api/edge/*’)
}

Now I am trying to create war using command
./gradlew edgeWar war

getting the error Task ‘edgeWar’ not found in root project ‘interstellarapi’.

I am relatively new to both Grails and Gradle, so not sure this is the right way to achieve what I want to.


I modified the build.gradle to

war {
archiveName "interstellar_edge_api.war"
include(‘com/nflx/edge/*’)
}

and created war using ./gradlew assemble.

The war is getting created, but its including the entire code.

Since grails has a diffrent structure like same package names inside controller/domain etc. whats the best way to indicate that in the include statement ?