Java Reference
In-Depth Information
Listing 10.10. Gradle build file for web application, using the war plugin
Thelistingincludesthe war plugin.Asusual,dependenciescomefromMavencentral.The
dependent libraries include JUnit and the Spring API libraries used for unit-testing. The in-
teresting feature is the providedCompile dependency. That tells Gradle that the servlet
and JSP APIs are required during compilation but not at deployment, because the container
will provide them.
The war plugin really shines when it's combined with the jetty plugin. Jetty is a light-
weight, open source servlet container hosted by the Eclipse foundation. [ 4 ] This makes it
convenient for testing web applications, and Gradle includes a jetty plugin with the
standard distribution.
4 See www.eclipse.org/jetty/ for details.
10.3.3. Automating Jetty in the Gradle build
To use Jetty in Gradle, you need to add the plugin dependency, but you also need to con-
figure some settings:
 
Search WWH ::




Custom Search