Gradle example to build Spring MVC application

In this example, we will create a simple Spring MVC ... application and build it with Gradle. The gradle script will use Tomcat as container and deploy ... the Spring MVC project with cargo plugin. All the files and directories are listed here F:\tmp ... of web.xml configuration, it equivalent to <servlet> <servlet-name>Spring MVC Dispatcher

Plugin with id 'tomcat' not found

When I run command "gradle tasks" to see what tasks available , I get this error.

plugin id tomcat not found

Dependencies and compile in Gradle

One of the greatest feature of modern build tool is the dependency management. Dependency management can be acknowledged as one of the best feature of Maven . Gradle makes it goes to next level.

In Gradle , dependencies is represented by configurations. A configuration is a named set of dependencies.

Task types in Gradle

Every task has a type, for example copy, jar package, execute external programs and so on.

The type of task is determined by the implementing task class:

Gradle configure selected subprojects

The subprojects is a TreeSet object, the element is Project object. To configure selected subprojects, using grep or findAll to filter projects.

In the closure, code before -> is the parameter, after that is the closure code. The code check every project's name properties, if it not contains "shared" string, add it to ext.webProjects.

Gradle Tasks

A task in gradle is an object. Object can have properties and methods, just like any other objects.

Any task you defined is not an empty object, it already contains some properties and methods. Because each new task inherit from DefaultTask.

Previous Page 1 ... 4 5