I am new to Gradle. Currently involved with an assignment where need to convert Ant build to Gradle build for a multi project gradle build mechansim. Most of projects are already coverted to gradle build. There is one project I am working on which needs to convert from Ant to gradle.
For a web archive I’ve added WAR plugin to gradle file. I am not able to understand which jar files (dependencies) will got to WEB-INF/lib directory.
My intention is to only have jar files which are under {project_dir}/lib directory.
But gradle war ends up with with many additional jar files apart from those under lib directory. So want to understand that how does gradle decide which jar files should go in WEB-INF/lib directory. I’ve read in document that those which are complie and runtime dependencies will go to WEB-INF/lib directory. But here I did not mentioned complie or runtime dependencies.
So, how does it decide which jar file should go under WEB-INF/lib directory ?
Does it have impact of multi project build mechanism on copying jar files for WEB-INF/lib ?
I tried the solution you have shared. Thing is compile dependencies are not been included in war file WEB-INF/lib directory (in my case dependencies com.*). Why it is so?
What I was doing wrong? Can you please explain me why it was wrong or share link to document for the same?
If I understood you correctly, you wanted that only jar files from lib directory will be copied into WEB-INF/lib. So I defined custom configuration localLibraries with jars from lib directory. And as classpath I use only localLibraries configuration (that is why only these files are in WEB-INF/lib directory).
If you’ll provide more details (what dependencies exactly should be copied into WEB-INF/lib directory), so it will be easier to provide a good solution for you.
I want jar files from lib directory as well as those defined in compile dependencies. I also want jar file generated from bundleJar task from this project.
Any input how can I do that? How can I use jar file generated with jar task defined in the same gradle file and use that jar file to WEB-INF/lib directory of war task?