providedCompile and providedRuntime dependencies do not work as advertised for WAR task
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Steps to Reproduce
1. create empty app
2. In build.gradle, change a compile or runtime dependency to providedCompile or providedRuntime, E.g.:
`runtime "com.h2database:h2"`
to
`providedRuntime "com.h2database:h2"`
3. run `grails war`
### Expected Behaviour
The build .war file should not contain the jars specified as providedCompile or providedRuntime, nor their transitive dependencies. This is as per the information specified in the [war command line docs](http://docs.grails.org/3.2.11/ref/Command%20Line/war.html):
> Grails 2.x war command allowed you to supply the argument nojars - which packaged the WAR with no jar files. In Grails 3.x, this argument is no longer available. Instead, you may use Gradle capabilities to generate a WAR without jar files. One option would be to set your dependencies as providedCompile and providedRuntime. Those two configurations have the same scope as the respective compile and runtime configurations, except that they are not added to the WAR archive. Check Gradle WAR Plugin documentation for more information.
### Actual Behaviour
The .war file does include the jars in `WEB-INF/lib/`. In the above case the `h2-1.4.194.jar` is still being included.
Note that using `provided` does seem to work - the libs are excluded in the war WEB-INF/lib.
### Environment Information
- **Operating System**: Ubuntu Linux 16.04
- **Grails Version:** 3.2.11
- **Gradle Version:** 3.5.1
- **JDK Version:** Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Contributor guide
Research direction
Start with the providedCompile and providedRuntime declarations in build.gradle and reproduce the problem with an empty app using grails war. Inspect how the WAR task handles those configurations; done when the specified jars and their transitive dependencies are absent from WEB-INF/lib while provided continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100