This chapter describes how to build such a web application.
Topics:
The example application that you build in this chapter displays a list of people, with their names and age, on a web page. It also allows you to add a new person. The details of the people are stored in a Coherence cache.
This application contains the following parts:
A Coherence GAR project, which contains a Person POJO (Plain Old Java Object), which you need to build into a Portable Object, a utility class to access the cache, and Coherence cache definitions
A Java EE web application, which you need to build into a WAR, which contains a servlet and a deployment descriptor
A project to assemble the GAR and WAR into an EAR and deploy that EAR to WebLogic Server
In this example, you can see how to build a multi-module Maven project, with dependencies between modules, and how to assemble our application components into a deployable EAR file that contains the whole application.
The aim of this chapter is to show how to use Maven to build whole applications, not to demonstrate how to write web or Coherence applications, so the content of the example itself, in terms of the servlet and the coherence code, is quite basic. For more information, refer to Building Java EE Projects for WebLogic Server with Maven and Building Oracle Coherence Projects with Maven.
Maven lets you create projects with multiple modules. Each module is in effect another Maven project. At the highest level, you have a POM file that tells Maven about the modules and lets you build the whole application with one Maven command.
Each of the modules are placed in a subdirectory of the root of the top-level project. In the example, the top-level project is called my-real-app
and the three modules are my-real-app-gar
, my-real-app-war
and my-real-app-ear
. The Maven coordinates of the projects are as follows:
GroupId | ArtifactId | Version | Packaging |
---|---|---|---|
|
|
1.0-SNAPSHOT |
|
|
|
1.0-SNAPSHOT |
|
|
|
1.0-SNAPSHOT |
|
|
|
1.0-SNAPSHOT |
|
The following are the files that make up the application:
pom.xml my-real-app-gar/pom.xml my-real-app-gar/src/main/resources/META-INF/pof-config.xml my-real-app-gar/src/main/resources/META-INF/coherence-application.xml my-real-app-gar/src/main/resources/META-INF/cache-config.xml my-real-app-gar/src/main/java/org/mycompany/CacheWrapper.java my-real-app-gar/src/main/java/org/mycompany/Person.java my-real-app-war/pom.xml my-real-app-war/src/main/webapp/WEB-INF/web.xml my-real-app-war/src/main/java/org/mycompany/servlets/MyServlet.java my-real-app-ear/pom.xml my-real-app-ear/src/main/application/META-INF/weblogic-application.xml
At the highest level, the POM file points to the three modules.
The my-real-app-gar
directory contains the Coherence GAR project. It contains its own POM, the Coherence configuration files, a POJO/POF class definition (Person.java
) and a utility class that is needed to access the cache (CacheWrapper.java
).
The my-real-app-war
directory contains the web application. It contains its own POM, a Servlet and a deployment descriptor. This project depends on the my-real-app-gar
project.
The my-real-app-ear
directory contains the deployment descriptor for the EAR file and a POM file to build and deploy the EAR.
To build the example project, you create the directory, and then create the GAR, WAR, and EAR projects.
This section includes the following topics:
Create a directory to hold the projects, using the following command:
mkdir my-real-app
Throughout the rest of this chapter, paths shown are relative to this directory.
This section includes the following topics:
You can create the GAR project either using an archetype, as described in Creating a Coherence Project from a Maven Archetype, or you can create the directories and files manually:
To use the archetype, run the following command:
mvn archetype:generate -DarchetypeGroupId=com.oracle.coherence.archetype -DarchetypeArtifactId=gar-maven-archetype -DarchetypeVersion=12.2.1-0-0 -DgroupId=org.mycompany -DartifactId=my-real-app-gar -Dversion=1.0-SNAPSHOT
To create the project manually, use the following commands to create the necessary directories:
mkdir -p my-real-app-gar/src/main/resources/META-INF mkdir -p my-real-app-gar/src/main/java/org/mycompany
If you use the archetype, you already have a POM file. Modify that file to match the following example. If you create the project manually, create the POM file (my-real-app-gar/pom.xml
) with the following contents:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <packaging>gar</packaging> <parent> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> </parent> <dependencies> <dependency> <groupId>com.oracle.coherence</groupId> <artifactId>gar-maven-plugin</artifactId> <version>12.2.1-0-0</version> <scope>provided</scope> </dependency> </dependencies> <build> <pluginManagement> <plugins> <plugin> <groupId>com.oracle.coherence</groupId> <artifactId>gar-maven-plugin</artifactId> <version>${coherence.version}</version> <extensions>true</extensions> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>com.oracle.coherence</groupId> <artifactId>gar-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <generatePof>true</generatePof> </configuration> </plugin> </plugins> </build> </project>
Examine the POM file to understand each part of the file:
The Maven coordinates for this project are set:
<groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <packaging>gar</packaging>
Notice that the packaging is gar
because you use the Coherence Maven plug-in to build this project into a Coherence GAR file.
The coordinates of the parent project are set. These coordinates point back to the top-level project. You need to create the POM for the top-level project in a later step.
<parent> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> </parent>
The dependencies
section identifies any dependencies that this project has. In this case, you depend only on the Coherence library, that is, com.oracle.coherence:coherence:12.2.1-0-0
. The scope provided
means that this library is just for compilation and does not need to be packaged in the artifact that you build (the GAR file) as it is already provided in the runtime environment.
<dependencies> <dependency> <groupId>com.oracle.coherence</groupId> <artifactId>gar-maven-plugin</artifactId> <version>12.2.1-0-0</version> <scope>provided</scope> </dependency> </dependencies>
The pluginManagement
section tells Maven to enable extensions
for this plug-in. This is necessary to allow Maven to recognize GAR files as a target artefact type.
<pluginManagement> <plugins> <plugin> <groupId>com.oracle.coherence</groupId> <artifactId>gar-maven-plugin</artifactId> <version>${coherence.version}</version> <extensions>true</extensions> </plugin> </plugins> </pluginManagement>
The plugins
section includes any information that you must pass to the Coherence GAR plug-in. In this case, you must set generatePof
to true
so that the plug-in looks for POJOs with POF annotations and generate the necessary artifacts.
<plugins> <plugin> <groupId>com.oracle.coherence</groupId> <artifactId>gar-maven-plugin</artifactId> <extensions>true</extensions> <configuration> <generatePof>true</generatePof> </configuration> </plugin> </plugins>
There are three Coherence configuration files that you need in your GAR project. If you use the archetype, the files already exist, but you need to modify them to match the following examples. If you create the project manually, create these files in the following locations:
my-real-app-gar/src/main/resources/META-INF/pof-config.xml my-real-app-gar/src/main/resources/META-INF/coherence-application.xml my-real-app-gar/src/main/resources/META-INF/cache-config.xml
The following example shows the contents for the pof-config.xml file:
<?xml version="1.0"?> <pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof -config coherence-pof-config.xsd"> <user-type-list> <!-- by default just include coherence POF user types --> <include>coherence-pof-config.xml</include> </user-type-list> </pof-config>
This file requires little or no modification if you created it with the archetype.
The following example shows the contents for the coherence-application.xml file:
<?xml version="1.0" encoding="ISO-8859-1"?> <coherence-application xmlns="http://xmlns.oracle.com/weblogic/coherence-application"> <cache-configuration-ref>META-INF/cache-config.xml</cache-configuration-ref> <pof-configuration-ref>META-INF/pof-config.xml</pof-configuration-ref> </coherence-application>
This file requires little or no modification if you created it with the archetype.
The cache-config.xml file must be updated if you have used the archetype.
In this file, create a cache named People, with a caching scheme named real-distributed-gar and a service name of RealDistributedCache, which uses the local backing scheme and is automatically started. If you are not familiar with these terms, see Building Oracle Coherence Projects with Maven. The following shows an example of the file:
<?xml version="1.0"?> <cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config" xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd"> <caching-scheme-mapping> <cache-mapping> <cache-name>People</cache-name> <scheme-name>real-distributed-gar</scheme-name> </cache-mapping> </caching-scheme-mapping> <caching-schemes> <distributed-scheme> <scheme-name>real-distributed-gar</scheme-name> <service-name>RealDistributedCache</service-name> <backing-map-scheme> <local-scheme/> </backing-map-scheme> <autostart>true</autostart> </distributed-scheme> </caching-schemes> </cache-config>
Create the Person object, which will store information in the cache. Create a new Java class in the following location:
my-real-app-gar/src/main/java/org/mycompany/Person.java
The following is the content for this class:
package org.mycompany;
import com.tangosol.io.pof.annotation.Portable; import com.tangosol.io.pof.annotation.PortableProperty;
@Portable public class Person { @PortableProperty(0) public String name; @PortableProperty(1) public int age; public Person() {}
public Person(String name, int age) { this.name = name; this.age = age; }
public String getName() { return this.name; } public int getAge() { return this.age; } }
This POJO tells Coherence what to do with the class. Because the focus of this chapter is on building applications with Maven, it does not go into the details of writing Coherence applications. For more information on Coherence, refer to Building Oracle Coherence Projects with Maven.
Create a small wrapper class that you can use to access the cache. Create another Java class in this location:
my-real-app-gar/src/main/java/org/mycompany/CacheWrapper.java
The following is the content for this class:
package org.mycompany;
import org.mycompany.Person; import com.tangosol.net.CacheFactory; import java.util.Set;
public class CacheWrapper { private static CacheWrapper INSTANCE;
public Set getPeople() { return CacheFactory.getCache("People").entrySet(); }
public void addPerson(int personid, String name, int age) { CacheFactory.getCache("People").put(personid, new Person(name, age)); }
public static final CacheWrapper getInstance() { if(INSTANCE == null) INSTANCE = new CacheWrapper(); return INSTANCE; } }
Later, you can use this class in a Servlet to get data from the cache and to add new data to the cache.
This section includes the following topics:
You can create the WAR project either using an archetype as described in Building Java EE Projects for WebLogic Server with Maven, or you can create the directories and files manually.
To use the archetype, run the following command:
mvn archetype:generate -DarchetypeArtifactId=basic-webapp -DarchetypeVersion=12.2.1-0-0 -DgroupId=org.mycompany -DartifactId=my-real-app-war -Dversion=1.0-SNAPSHOT
If you use the archetype, you must remove any unnecessary files included in the project.
To create the project manually, use the following commands to create the necessary directories:
mkdir -p my-real-app-war/src/main/webapp/WEB-INF mkdir -p my-real-app-war/src/main/java/org/mycompany/servlets
If you use the archetype, the POM file already exists. Modify that file to match the following example. If you created the project manually, create the POM file (my-real-app-war/pom.xml
) with the following contents:
<project> <modelVersion>4.0.0</modelVersion> <groupId>org.mycompany</groupId> <artifactId>my-real-app-war</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <parent> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> </parent> <name>my-real-app-war</name> <dependencies> <dependency> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> </dependencies> </project>
Examine the POM file to understand each part of the file:
You must set the coordinates for this project. Notice that the packaging for this project is war
.
<groupId>org.mycompany</groupId> <artifactId>my-real-app-war</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging>
Define the parent, as you did in the GAR project:
<parent> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> </parent>
List the dependencies for this project. In this case, there are two dependencies: the GAR project to access the POJO and utility classes you defined there and the Servlet API. This sets the display-name for the web application.
<dependencies> <dependency> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope>provided</scope> </dependency> </dependencies>
The web application has a simple Java EE deployment descriptor that sets the display-name
for the web application. It is located at the following location:
my-real-app-war/src/main/webapp/WEB-INF/web.xml
The following are the contents of this file:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>my-real-app-war</display-name> </web-app>
To create the servlet, locate the MyServlet.java file:
my-real-app-war/src/main/java/org/mycompany/servlets/MyServlet.java
The servlet displays a list of people that are currently in the cache and allows you to add a new person to the cache. The aim of the section is to learn how to build these types of applications with Maven, not to learn how to write Java EE web applications, hence the use of a simplistic servlet.
The following is the content for the servlet class:
package org.mycompany.servlets;
import org.mycompany.Person; import org.mycompany.CacheWrapper;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import java.io.IOException; import java.io.PrintWriter; import java.util.Map; import java.util.Set; import java.util.Iterator;
@WebServlet(name = "MyServlet", urlPatterns = "MyServlet") public class MyServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String id = request.getParameter("id"); String name = request.getParameter("name"); String age = request.getParameter("age"); if (name == null || name.isEmpty() || age == null || age.isEmpty() || id == null || id.isEmpty()) { // no need to add a new entry } else { // we have a new entry - so add it CacheWrapper.getInstance().addPerson(Integer.parseInt(id), name, Integer.parseInt(age)); } renderPage(request, response); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { renderPage(request, response); }
private void renderPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // get the data Set people = CacheWrapper.getInstance().getPeople(); PrintWriter out = response.getWriter(); out.write("<html><head><title>MyServlet</title></head><body>"); out.write("<h2>Add a new person</h2>"); out.write("<form name=\"myform\" method=\"POST\">"); out.write("ID:<input type=\"text\" name=\"id\"/><br/>"); out.write("Name:<input type=\"text\" name=\"name\"/><br/>"); out.write("Age:<input type=\"text\" name=\"age\"/><br/>"); out.write("<input type=\"submit\" name=\"submit\" value=\"add\"/>"); out.write("</form>"); out.write("<h2>People in the cache now</h2>"); out.write("<table><tr><th>ID</th><th>Name</th><th>Age</th></tr>"); // for each person in data if (people != null) { Iterator i = people.iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry)i.next(); out.write("<tr><td>" + entry.getKey() + "</td><td>" + ((Person)entry.getValue()).getName() + "</td><td>" + ((Person)entry.getValue()).getAge() + "</td></tr>"); } } out.write("</table></body></html>"); } }
Check if the user has entered any data in the form. If so, add a new person to the cache using that data. Note that this application has fairly minimal error handling. To add the new person to the cache, use the addPerson() method in the CacheWrapper class that you created in your GAR project.
Print out the contents of the cache in a table. In this example, assume that the cache has a reasonably small number of entries, and read them all using the getPeople() method in the CacheWrapper class.
The EAR project manages assembling the WAR and the GAR into an EAR.
This section includes the following topics:
Create the EAR project manually using the following command:
mkdir -p my-real-app-ear/src/main/application/META-INF
There are two files in this project: a POM file and a deployment descriptor:
my-real-app-ear/pom.xml my-real-app-ear/src/main/application/META-INF/weblogic-application.xml
The following are the contents of the POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.mycompany</groupId> <artifactId>my-real-app-ear</artifactId> <version>1.0-SNAPSHOT</version> <packaging>ear</packaging> <parent> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> </parent> <name>ear assembly</name> <dependencies> <dependency> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <type>gar</type> <scope>optional</scope> </dependency> <dependency> <groupId>org.mycompany</groupId> <artifactId>my-real-app-war</artifactId> <version>1.0-SNAPSHOT</version> <type>war</type> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-ear-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> <artifactTypeMappings> <artifactTypeMapping type="gar" mapping="jar"/> </artifactTypeMappings> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-gar-locally</id> <phase>prepare-package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <type>gar</type> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> <plugin> <groupId>com.oracle.weblogic</groupId> <artifactId>weblogic-maven-plugin</artifactId> <version>12.2.1-0-0</version> <executions> <!--Deploy the application to the server--> <execution> <phase>pre-integration-test</phase> <goals> <goal>deploy</goal> </goals> <configuration> <adminurl>t3://127.0.0.1:7001</adminurl> <user>weblogic</user> <password>welcome1</password> <middlewareHome>/home/mark/space/maven/wls030213</middlewareHome> <!--The location of the file or directory to be deployed--> <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> <!--The target servers where the application is deployed--> <targets>AdminServer</targets> <verbose>true</verbose> <name>${project.build.finalName}</name> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
Examine the POM file to understand each part of the file:
Set the Maven coordinates for this project, and point to the parent:
<groupId>org.mycompany</groupId> <artifactId>my-real-app-ear</artifactId> <version>1.0-SNAPSHOT</version> <packaging>ear</packaging> <parent> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> </parent>
The dependencies on the WAR and GAR projects are listed:
<dependencies> <dependency> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <type>gar</type> <scope>optional</scope> </dependency> <dependency> <groupId>org.mycompany</groupId> <artifactId>my-real-app-war</artifactId> <version>1.0-SNAPSHOT</version> <type>war</type> </dependency> </dependencies>
The first of three separate plug-in configurations is for the maven-ear-plugin
. You need to tell it to treat a gar
file like a jar
file by adding an artifactTypeMapping
, as in the following example:
<plugin> <artifactId>maven-ear-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> <artifactTypeMappings> <artifactTypeMapping type="gar" mapping="jar"/> </artifactTypeMappings> </configuration> </plugin>
The second plug-in configuration is for the maven-dependency-plugin
. Configure it to copy the GAR file from the my-real-app-gar
project's output (target
) directory into the EAR project:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-gar-locally</id> <phase>prepare-package</phase> <goals> <goal>copy</goal> </goals> <configuration> <artifactItems> <artifactItem> <groupId>org.mycompany</groupId> <artifactId>my-real-app-gar</artifactId> <version>1.0-SNAPSHOT</version> <type>gar</type> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin>
The third plug-in configuration is for the weblogic-maven-plugin
. Tell it how to deploy the resulting EAR file. In this section, you must update the adminurl
, user
, password
, and target
parameters to match your environment. For details on these parameters, see Table 10-1.
<plugin> <groupId>com.oracle.weblogic</groupId> <artifactId>weblogic-maven-plugin</artifactId> <version>12.2.1-0-0</version> <executions> <!--Deploy the application to the server--> <execution> <phase>pre-integration-test</phase> <goals> <goal>deploy</goal> </goals> <configuration> <adminurl>t3://127.0.0.1:7001</adminurl> <user>weblogic</user> <password>welcome1</password> <!--The location of the file or directory to be deployed--> <source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source> <!--The target servers where the application is deployed--> <targets>AdminServer</targets> <verbose>true</verbose> <name>${project.build.finalName}</name> </configuration> </execution> </executions> </plugin>
Once you have completed the POM project, add a deployment descriptor.
The WebLogic deployment descriptor for the EAR file is located in this file:
my-real-app-ear/src/main/application/META-INF/weblogic-application.xml
The following are the contents:
<weblogic-application> <module> <name>GAR</name> <type>GAR</type> <path>my-real-app-gar-1.0-SNAPSHOT.gar</path> </module> </weblogic-application>
This deployment descriptor provides the details for where in the EAR file the GAR file should be placed, and what it should be called.
Create the top-level POM. This is located in the pom.xml file in the root directory of your application and contains the following:
<project> <modelVersion>4.0.0</modelVersion> <groupId>org.mycompany</groupId> <artifactId>my-real-app</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>my-real-app</name> <modules> <module>my-real-app-war</module> <module>my-real-app-gar</module> <module>my-real-app-ear</module> </modules> <properties> <coherence.version>12.2.1-0-0</coherence.version> </properties> </project>
Set the coordinates for the project. These match the parent coordinates you specified in each of the three projects. Note that the packaging is pom
. This tells Maven that this project is an assembly of a set of sub-projects, as named in the modules
section.
There are one module entry for each of the three sub-projects.
Since this POM is the parent of the other three, and since POM's inherit from their parents, you can add any common properties to this POM and they will be available in all the three sub-projects. In this case, you are adding the property coherence.version
.
You can now build the application using Maven by using one or more of the following commands (in the top-level directory my-real-app
):
mvn compile mvn package mvn verify
Maven executes all of the phases up to the one named. These commands have the following effect:
Command | Details |
---|---|
mvn compile |
Compiles the Java source into target class files. |
mvn package |
|
mvn verify |
|