0

I am using grails 4.0

In my build.gradle, I have following entry.

war {
    exclude("**/abc-1.0.0.jar", "**/xyz-1.0.0.jar")
}

But for some reason, both these jars are included in the war file, when I run the command grails prod war

I have tried varies options, but nothing seems to work.

Pritesh Mhatre
  • 3,847
  • 2
  • 23
  • 27
  • Do you have the option to mark `abc` and `xyz` as `provided`? – Jeff Scott Brown Dec 03 '19 at 00:13
  • Thanks for your response @JeffScottBrown ... but it did not help. The application compiled fine, even the tomcat container started fine (no errors in container logs); but the application gave 404 error..failed to start (nothing is printed in application log files). May be because transitive dependencies are missing after using `provided`. I had tried marking dependencies `compileOnly` as well, but that does not stop them from being included in the war – Pritesh Mhatre Dec 05 '19 at 14:35
  • I can't reproduce that behavior. `provided` dependencies seem to behave the way I expect them too. I am sorry that i can't help. Best of luck! – Jeff Scott Brown Dec 05 '19 at 14:57
  • That's absolutely fine @JeffScottBrown , I am just removing those jars from war file using `zip` utility to delete the files. Thanks a lot for your time, Grails saved me a lot of development time over last 4-5 years! It's awesome. – Pritesh Mhatre Dec 06 '19 at 03:39

1 Answers1

-1

are you sure you're not trying to limit dependencies...?

ex.

dependencies {
...
    compile("org.grails:grails-plugin-interceptors"){
        exclude(module: 'org.slf4j:slf4j-api:1.7.22')
        exclude(module: 'org.slf4j:jcl-over-slf4j:1.7.22')
    }

}
Orubel
  • 316
  • 4
  • 16
  • Yes, pretty sure. These files are needed at compile time but not needed in the deployment as they are provided by the container. I tried compileOnly dependency type, but for some reason when these are marked as 'compileOnly'; they are not available in gsp pages compilation & I get compile errors. – Pritesh Mhatre Nov 30 '19 at 14:54