12 Building ADF Projects with Maven

This chapter provides details on how to use the Oracle Application Development Framework Maven archetypes to create, build, and deploy Oracle Application Development Framework applications.

This chapter includes the following topics:

For more information about using the Oracle ADF development plug-in with Maven, see "Building and Running with Apache Maven " in Developing Applications with Oracle JDeveloper.

12.1 Introduction to Building Oracle ADF Projects with Maven

Two Maven plug-ins and an archetype are provided for Oracle ADF projects. Table 12-1 describes the Maven coordinates.

Table 12-1 Maven Coordinates with Oracle ADF

Artifact groupId artifactId Version

ADF ojmake plug-in

com.oracle.adf.plugin

ojmake

12.2.1-0-0

ADF ojdeploy plug-in

com.oracle.adf.plugin

ojdeploy

12.2.1-0-0

ADF archetype

com.oracle.adf.archetype

oracle-adffaces-ejb

12.2.1-0-0


JDeveloper also has extensive support for Maven. This documentation covers Maven use outside of JDeveloper. Refer to "Building and Running with Apache Maven" in Developing Applications with Oracle JDeveloper for more details about using Maven within JDeveloper.

12.2 Creating an ADF Application Using the Maven Archetype

To create a new Oracle ADF application using the Oracle ADF application Maven archetype, issue a command similar to the following:

mvn archetype:generate
-DarchetypeGroupId=com.oracle.adf.archetype
 -DarchetypeArtifactId=oracle-adffaces-ejb
 -DarchetypeVersion=12.2.1-0-0
 -DgroupId=org.mycompany
 -DartifactId=my-adf-application
 -Dversion=1.0-SNAPSHOT

This command runs Maven's archetype:generate goal which allows you to create a new project from an archetype. Table 12-2 describes the parameters.

Table 12-2 Parameters for the Oracle ADF Project

Parameter Purpose

archetypeGroupId

The groupId of the archetype that you want to use to create the new project. This must be com.oracle.adf.archetype in the example.

archetypeArtifactId

The artifactId of the archetype that you want to use to create the new project. This must be oracle-adffaces-ejb as shown in the example.

archetypeVersion

The version of the archetype that you want to use to create the new project. This must be 12.2.1-0-0 as shown in the example.

groupId

The groupId for your new project. This usually starts with your organization's domain name in reverse format.

artifactId

The artifactId for your new project. This is usually an identifier for this project.

version

The version for your new project. This is usually 1.0-SNAPSHOT for a new project.


You can also run the command without any arguments, as shown in the following example. In this case, Maven displays a list of available archetypes and prompts you to enter the required information.

mvn archetype:generate

12.3 Building Your Oracle ADF Project with Maven

After you have written your code, you can use Maven to build the project:

  1. To compile your project, execute the following command:

    mvn compile
    

    This command runs the ojmake plug-in.

  2. To package the project into an EAR file, execute the following command (note that this actually runs all steps up to package, including the compile again):

    mvn package
    

    This command runs the ojdeploy plug-in.