Oracle by Example brandingConfiguring and Building an ADF Application using Maven in Oracle Developer Cloud Service Classic

section 0Before You Begin

This 15-minute tutorial shows you how to configure and build an Oracle Application Development Framework (Oracle ADF) application with Apache Maven and Oracle Maven Repository by using Oracle JDeveloper and Oracle Developer Cloud Service.

Background

Oracle Developer Cloud Service can build Oracle ADF applications by using Maven, Oracle Maven Repository, JDeveloper, Oracle ADF libraries, and OJMake and OJDeploy utilities.

In this tutorial, you use the Oracle Alta UI Work Better sample application and configure it in JDeveloper to use Maven. You configure the Maven Project Object model (POM) file to access the Oracle Maven Repository to download Oracle ADF libraries, and to access the OJMake and OJDeploy utilities available on the Oracle Developer Cloud Service build system. You then create a job in Oracle Developer Cloud Service that runs a Maven build and generates the artifacts.

The Alta UI Work Better sample application is a demo application that uses the Alta UI to develop the most recent Oracle Cloud products.

What Do You Need?


section 1Add the Maven POM File to the Oracle ADF Application

In this section, you add a Maven pom.xml file to an Oracle ADF application in JDeveloper.

  1. In JDeveloper, if you aren't using the Studio Developer role, from the Tools menu, select Switch Roles, and then select Studio Developer (All Features). Save all files and restart JDeveloper.
  2. Open the WorkBetterFaces application from the cloned Git repository of the project.
  3. From the File menu, select New, and then select From Gallery.
    File - New submenu of JDeveloper
    Description of the illustration jdev_new.png
  4. In the New Gallery dialog box, select Maven in the General category, select Application POM in the Items list, and click OK.
    New Gallery dialog box
    Description of the illustration add_maven_01.png
  5. In the Create a Maven POM for the Application dialog box, select the Include packaging plugin information (uses ojdeploy) and Include compile plugin information (uses ojmake) check boxes and click OK.
    Create a Maven POM for the Application dialog box
    Description of the illustration add_maven_02.png
    A pom.xml file is added to the ADF application.
    Application Resources pane
    Description of the illustration add_maven_03.png

section 2Configure the POM File to Access Oracle Maven Repository, OJMake, and OJDeploy

In this section, you configure the POM file to access the Oracle Maven Repository and to use the OJMake and OJDeploy utilities. The OJMake and OJDeploy utilities are available on the build system of Oracle Developer Cloud Service and can be accessed by using Oracle Developer Cloud Service system environment variables.

  1. In JDeveloper, double-click pom.xml to open it in the editor.
    General tab of the POM file editor
    Description of the illustration config_maven_01.png
  2. Click the Repositories tab.
    Repositories tab of the POM file editor
    Description of the illustration config_maven_02.png
  3. In the Remote Repositories section, click Add theAddRepositoryicon.
  4. To add the Oracle Maven Repository as a remote repository, enter the following values:
    • Name: OracleMaven
    • ID: maven.oracle.com
    • URL: https://maven.oracle.com
    Remote Repositories section of the POM file editor
    Description of the illustration config_maven_03.png
  5. Click the Plugins tab.
    Plugins tab of the POM file editor
    Description of the illustration config_maven_04.png
  6. In the Plugin table, click the first column in the first row to select the ojmake plugin row.
    Plugins tab of the POM file editor
    Description of the illustration config_maven_05.png
  7. In the Configuration Parameters table, update the parameter value of the ojmake parameter to ${env.ORACLE_HOME_SOA_12_2_1}/jdev/bin/ojmake.
    Plugins tab of the POM file editor
    Description of the illustration config_maven_06.png
    The ORACLE_HOME_SOA_12_2_1 environment variable defines the path of the JDeveloper 12.2.1 directory that's installed on the Oracle Developer Cloud Service build executor.
  8. In the Plugin table, click the first column in the second row to select the ojdeploy plugin row.
    Plugins tab of the POM file editor
    Description of the illustration config_maven_07.png
  9. In the Configuration Parameters table, update the parameter value of the ojdeploy parameter to ${env.ORACLE_HOME_SOA_12_2_1}/jdev/bin/ojdeploy.
    Plugins tab of the POM file editor
    Description of the illustration config_maven_08.png
  10. Save the pom.xml file.
  11. Using the Team > Git menu options, use the Add option to add the pom.xml file to the Git repository index, use the Commit option to commit it, and the Push coption to push the commit to the project Git repository.

section 3Create and Configure a Build Job in Oracle Developer Cloud Service

In this section, you configure a build job to run Maven and deploy the archived artifacts.

  1. In the Oracle Developer Cloud Service web interface, create a ADF_Maven_Build job and open its configuration page.
    See the Create and Configure a Build Job in Developer Cloud OBE in the Want to Learn More section to learn about how to create and configure a job in Oracle Developer Cloud Service.
  2. On the Main tab of Configure build job, select JDK 8 in the JDK field. ADF 12c (12.2.1.0.0) applications require JDK 8.
    Main tab of the Configure Build job page
    Description of the illustration config_build_maven_01.png
  3. Click the Source Control tab and select the Git option. In the Repositories section, select the adf-sample-application.git Git repository.
    Source Control tab of the Configure Build job page
    Description of the illustration config_build_source.png
  4. Click the Environment tab, select the Connect Oracle Maven Repository check box, and enter your Oracle Account user name and password.
    If not done before, accept the Oracle Maven Repository license agreement at https://www.oracle.com/webapps/maven/register/license.html.
    Environment tab of the Configure Build job page
    Description of the illustration config_build_maven_02.png
  5. Click the Build Steps tab, click Add Build Step and select Invoke Maven 3.
    Build Steps tab of the Configure Build job page
    Description of the illustration config_build_maven_03.png
  6. In the POM File field, enter WorkBetterFaces/pom.xml as the path of the POM file.
    You can verify the path in the Code page.
    Build Steps tab of the Configure Build job page
    Description of the illustration config_build_maven_04.png
  7. Click the Post Build tab, select the Archive the artifacts check box, and enter WorkBetterFaces/target/*.ear in Files To Archive.
    Post Build tab of the Configure Build job page
    Description of the illustration config_build_maven_05.png
  8. Click Save.
  9. In the ADF_Maven_Build details page, click Build Now and wait for the build to complete.
    Build Now button of the job
    Description of the illustration config_build_maven_06.png
    Check the build's progress in the Build History section.
  10. After the build is completed, expand Artifacts of Last Build to view the archived artifacts.
  11. To view the build status of ADF_Maven_Build in JDeveloper, refresh the project in Team Server. Place your cursor over Demo and click the Refresh icon.
    The Refresh icon of the Team tab
    Description of the illustration jdev_team_refresh.png
  12. On the Team tab, expand Builds.
    Build section in the JDeveloper Team tab
    Description of the illustration config_build_maven_07.png
  13. After the build is successful, in the Deploy page of Oracle Developer Cloud Service, create a deployment configuration and deploy the ADF application to Oracle Java Cloud Service. See the Deploying an Application from Oracle Developer Cloud Service to Oracle Java Cloud Service OBE in the Want to Learn More section to learn about how to deploy an application to Oracle Java Cloud Service.

more informationWant to Learn More?