Building your web application (Java)
You can build your web application using Maven commands. It is your choice whether you run the installation in interactive mode or using predefined properties.
Procedure
- Use one of the following methods to generate a list of publically available Maven archetypes:
Note: For more information on Maven Archetypes, see Introduction to Archetypes (a webpage at the Apache Maven Project website).
Option Description Interactive mode to select properties one at a time - Run the following Maven command:
mvn archetype:generate - Filter the archetype list to find the DXA archetype. Type dxa.
- Select dxa-webapp-archetype.
- Choose the version of the archetype.
- Specify the following properties to describe your web application. This set of properties describes a unique application revision:
groupIdartifactIdversionpackage
Command with predefined properties Run the following Maven command with all the property values included. Example:
mvn archetype:generate -DarchetypeGroupId=com.sdl.dxa -DarchetypeArtifactId=dxa-webapp-archetype -DarchetypeVersion=2.0.0-CTP1 -DgroupId=org.example -DartifactId=dxa-webapp -Dversion=1.0-SNAPSHOT -Dpackage=org.exampleA subdirectory named after theartifactIdis created. - Run the following Maven command:
- Go to the subdirectory named after the
artifactIdyou specified and then to the src/main/resources subdirectory. - Edit the following configuration file to specify the Discovery Service URL or OAuth credentials:
cd_client_conf.xml
- Run the following Maven command to build the application:
mvn clean package -P<VERSION>If you are using the legacy (pre-2.0) system architecture, you must include an additional legacy property to override the defaults and build a legacy application:
For example:
mvn clean package -DlegacyNote: This command accepts optional properties to enable various modules. You can do this at the same time you build the application or at a later time, as described in a separate topic.
What to do next
Once your web application is built, you can run it.