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

  1. Use one of the following methods to generate a list of publically available Maven archetypes:
    OptionDescription
    Interactive mode to select properties one at a time
    1. Run the following Maven command:
      mvn archetype:generate
    2. Filter the archetype list to find the DXA archetype. Type dxa.
    3. Select dxa-webapp-archetype.
    4. Choose the version of the archetype.
    5. Specify the following properties to describe your web application. This set of properties describes a unique application revision:
      • groupId
      • artifactId
      • version
      • package
    Command with predefined propertiesRun 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.example
    A subdirectory named after the artifactId is created.
  2. Go to the subdirectory named after the artifactId you specified and then to the src/main/resources subdirectory.
  3. Edit the following configuration file to specify the Discovery Service URL or OAuth credentials:
    cd_client_conf.xml
  4. 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 -Dlegacy

What to do next

Once your web application is built, you can run it.