Before You Begin
Purpose
This tutorial shows you how to build an Oracle ADF application with Apache Maven and Oracle Maven Repository using Oracle JDeveloper and Oracle Developer Cloud Service.
Time to Complete
30 Minutes
Background
Oracle Developer Cloud Service can build ADF applications using Maven, Oracle Maven Repository, JDeveloper and ADF libraries, and OJMake and OJDeploy utilities available on the Hudson executor of Oracle Developer Cloud Service.
Scenario
In this tutorial, you will use the Oracle Alta UI Work Better sample application and configure it in JDeveloper to use Maven. You will configure the Maven POM file to access the Oracle Maven Repository to download ADF libraries, and to access the OJMake and OJDeploy utilities available on the Oracle Developer Cloud Service Hudson executor. You will then create a job in Oracle Developer Cloud Service that will run a Maven build and generate the artifacts.
The Alta UI Work Better sample application is a demo application that uses Alta UI, which is used to develop the most recent Oracle Cloud products.
Context
This tutorial expects you to be familiar with creating and configuring a job in Oracle Developer Cloud Service. You should also be familiar with JDeveloper, Maven, POM file, Oracle Maven Repository, and OJMake and OJDeploy utilities.
If you are new to Maven, see https://maven.apache.org/
.
If you are new to Oracle Maven Repsoitory, see https://maven.oracle.com/doc.html
.
The OJMake and OJDeploy utilities are available in JDeveloper that aid you in building and deploying applications. No installation is required to use OJMake or OJDeploy as both are available in JDeveloper by default. To know more about OJMake and OJDeploy, see the references to Oracle Fusion Middleware documentation in the Want to Learn More section.
What Do You Need?
-
A subscription to an Oracle Developer Cloud Service instance
-
An Oracle ADF application
Download the Oracle Alta UI Work Better Application Demo - 12.2.1.
-
One of the following supported browsers:
-
Chrome 48 or later
-
Firefox 38 or later
-
Internet Explorer 11 or 12
-
Safari 7 or 8 (Mac OS)
-
Safari Mobile (iOS)
-
-
Your Oracle Account username and password
-
You can install Maven (installation instructions) or use the JDeveloper Maven plugin installed at
%ORACLE_HOME%/oracle_common/modules.
Example:%ORACLE_HOME%/oracle_common/modules/org.apache.maven_3.2.5
. -
M2
,M2_HOME
,JAVA_HOME
, andPATH
environment variables set properly-
M2_HOME
set to the Maven directory
Example:M2_HOME=C:\Program Files\Apache Software Foundation\apache-maven-3.2.5
-
M2
set to the Mavenbin
directory
Example:M2=%M2_HOME%\bin
-
PATH
set to theM2
variable
Example:PATH=%PATH%;%M2%
-
JAVA_HOME
set to the JDK directory
Example:JAVA_HOME=C:\JDK8
-
-
An empty Git repository in an Oracle Developer Cloud Service project to which you have access
This tutorial assumes that you have created an ADF Sample Application project with an initial Git repository that is empty.
-
Accept the Oracle Maven Repository license agreement.
Open
https://www.oracle.com/webapps/maven/register/license.html
in your web browser, sign-in with your Oracle Account credentials, and accept the license agreement.
Setting Up the ADF Application in Oracle Developer Cloud Service
In this section, you will learn how to create and use a Team Server in JDeveloper to clone an Oracle Developer Cloud Service project Git repository. You will then add the sample ADF Application files to the cloned Git repository, commit, and push the updates to the project Git repository.
A Team Server is an extension in JDeveloper that you can use to manage your Oracle Developer Cloud Service projects from the IDE. Using the Team Server, you can clone the project repositories to your local computer, perform Git actions, manage project issues, and view status of project builds. The Oracle Developer Cloud Service Team Server extension is installed by default in JDeveloper.
Creating a Team Server in Oracle JDeveloper
-
Open JDeveloper.
-
From the Team menu, click Team Server, and then click Add Team Server.
View ImageDescription of this image -
In the New Team Server dialog, enter the following information:
-
Name: Enter
Developer Cloud Team Server
-
URL: Enter the URL of your organization on the Oracle Developer Cloud Service instance
Example:
https://developer.us2.oraclecloud.com/my-org/
View ImageDescription of this image Oracle Developer Cloud Service is the default provider of the Team Server. If necessary, click Proxy Configuration to configure the proxy settings.
-
Click OK.
The Team tab is now available in JDeveloper.
View ImageDescription of this image -
In the Team tab, click Click here to select project.
View ImageDescription of this image -
In the Developer Cloud Team Server list, click Login.
View ImageDescription of this image -
In the Login to Team Server dialog, enter the following information:
-
Username: Enter your Oracle Developer Cloud Service instance user name
-
Password: Enter your Oracle Developer Cloud Service instance password
View ImageDescription of this image -
-
Click Login.
After a successful login, the Team Server displays all projects that you own or are a member.
View ImageDescription of this image
Cloning the Project Git Repository
-
In the Developer Cloud Team Server project list, click ADF Sample Application.
View ImageDescription of this image -
Expand Sources and click the get link of the
adf-sample-application.git
repository.View ImageDescription of this image -
In the Get Sources from Oracle Developer Cloud Service dialog, click Get from Developer Server.
View ImageDescription of this image -
In the Welcome page of the Clone from Git wizard, click Next.
View ImageDescription of this image -
In the Remote Repository page, click Next.
View ImageDescription of this image The wizard picks the values for Repository URL, Username, and Password from the Team Server. If you prefer to use SSH, update the values of Repository URL and Private Key File before clicking Next.
-
In the Remote Branch page, click Next.
View ImageDescription of this image The page is empty because the Git repository being cloned is empty.
-
In the Destination page, if necessary, update the following information:
-
Destination: The path of the directory where you want to clone the Git repository
-
Clone Name: The name of the cloned Git repository directory
The Checkout Branch drop-down list is expected to be empty.
View ImageDescription of this image -
-
Click Next.
-
In the Git Clone Summary page, click Finish.
View ImageDescription of this image -
In the New Gallery dialog, click Cancel to close the dialog.
View ImageDescription of this image You will not create an application, but add the Oracle Alta UI Work Better Application to the cloned Git repository directory.
Committing and Pushing the ADF Application to Oracle Cloud Developer Service
-
In the cloned repository directory, extract the contents of the Oracle Alta UI Work Better Application zip file (
WorkBetterFaces1221.zip
).View ImageDescription of this image -
In JDeveloper, open the WorkBetterFaces application.
View ImageDescription of this image -
From the Team menu, select Git, and then select Add All.
View ImageDescription of this image -
In the Add All dialog, click OK.
View ImageDescription of this image After all files are added to the staging index, notice the icons in the Applications window have changed to show a + icon in the lower left corner.
View ImageDescription of this image -
From the Team menu, select Git, and then select Commit All.
View ImageDescription of this image -
In the Commit All dialog, enter a comment in Comments.
If necessary, specify your name and email address in the Author and Commiter fields in the
Name <email>
format.View ImageDescription of this image -
Click OK.
Notice the icons in the Applications window have changed to show a yellow circle in the lower-left corner.
View ImageDescription of this image -
From the Team menu, select Git, and then select Push.
View ImageDescription of this image -
In the Welcome page of the Push to Git wizard, click Next.
View ImageDescription of this image -
In the Remote Repository page, click Next.
View ImageDescription of this image The wizard picks the values for Repository URL, Username, and Password from the Team Server. If you prefer to use SSH, update the values of Repository URL and Private Key File before clicking Next.
-
In the Local Branch page, click Next.
View ImageDescription of this image The
master
branch was created when you committed the application files. -
In the Commits page, click Next.
View ImageDescription of this image -
In the Git Push Summary page, click Finish.
View ImageDescription of this image A Git Push progress bar appears in the Status bar of JDeveloper. Wait for JDeveloper to push all files to the project Git repository.
View ImageDescription of this image After the Git Push is complete, open the project in Oracle Developer Cloud Service web interface and verify the commit in the Project page.
View ImageDescription of this image
Configuring the ADF Application to use Maven
In this section, you will learn how to add a Maven
pom.xml
to an ADF Application in
JDeveloper and then configure it to access the
Oracle Maven Repository. You will also learn how to
configure the POM file to use the OJMake and
OJDeploy utilities with Oracle Developer Cloud
Service system environment variables.
To enable the Maven pom.xml
to access
the Oracle Maven Repository, you would need to enter
the encrypted Maven master password in settings-security.xml
and provide your encrypted Oracle SSO credentials in
the Maven settings.xml
file.
Adding the Maven POM file to the ADF Application
-
In JDeveloper, open the WorkBetterFaces application, if you closed it.
-
If you are not using the Studio Developer role of JDeveloper, switch to it.
In JDeveloper, from the Tools menu, select Switch Roles, and then select Studio Developer.
View ImageDescription of this image When you switch roles, JDeveloper will prompt you to save all files and restart it.
JDeveloper roles enable you to tailor the JDeveloper environment. Some features that are available in one role may not be available in another. The Studio Developer role allows you to access all features of JDeveloper.
-
From the File menu, click New, and then click From Gallery.
View ImageDescription of this image -
In the New Gallery dialog, select Maven in the General Category, and then select Application POM in the Items list.
View ImageDescription of this image -
Click OK.
-
In the Create a Maven POM for the Application dialog, select the Include packaging plugin information (uses ojdeploy) and Include compile plugin information (uses ojmake) check boxes and click OK.
View ImageDescription of this image A
pom.xml
file is added to the ADF application.View ImageDescription of this image
Configuring the POM file to Access Oracle Maven Repository, OJMake, and OJDeploy
-
Double-click
pom.xml
to open it in the code editor.View ImageDescription of this image -
Click the Repositories tab.
View ImageDescription of this image -
In the Remote Repositories section, click the
icon.
View ImageDescription of this image -
Enter the following information to add the Oracle Maven Repository as a remote repository:
-
Name:
OracleMaven
-
ID:
maven.oracle.com
-
URL:
https://maven.oracle.com
View ImageDescription of this image -
-
Click the Plugins tab.
View ImageDescription of this image -
In the Plugin table, click the leftmost column of the first row to select the ojmake plugin row.
View ImageDescription of this image -
In the Configuration Parameters table, update the Parameter Value of the ojmake parameter to
${env.ORACLE_HOME_SOA_12_2_1}/jdev/bin/ojmake
.View ImageDescription of this image The
ORACLE_HOME_SOA_12_2_1
environment variable defines the path of the JDeveloper 12.2.1 directory installed on the Oracle Developer Cloud Service Hudson executor. -
In the Plugin table, click the leftmost column of the second row to select the ojdeploy plugin row.
View ImageDescription of this image -
In the Configuration Parameters table, update the Parameter Value of the ojdeploy parameter to
${env.ORACLE_HOME_SOA_12_2_1}/jdev/bin/ojdeploy
.View ImageDescription of this image -
Save the
pom.xml
file.
Committing and Pushing Maven files to the Project Git Repository
-
From the Team menu, select Git, and then select Add All.
View ImageDescription of this image -
In the Add All dialog, click OK.
Note: When you add the Maven POM file to your application in JDeveloper, the selected project in the Applications window and the current application file are also updated and appear in the file list of the Add All dialog. Before you click OK, you may ignore the update to those files (
.jpr
and.jws
). To ignore the update, deselect the Select check box on the right of the file row.View ImageDescription of this image -
From the Team menu, select Git, and then select Commit All.
View ImageDescription of this image -
In the Commit All dialog, enter the commit comment in Comments.
If necessary, specify your name and email address in the Author and Commiter fields in the
Name <email>
format.View ImageDescription of this image Note: You may ignore the update to the project file (
.jpr
) and the application file (.jws
). To ignore the update, deselect the Select check box on the right of the file row. - Click OK.
-
From the Team menu, select Git, and then select Push.
View ImageDescription of this image -
In the Welcome page of the Push to Git wizard, click Next.
View ImageDescription of this image -
In the Remote Repository page, click Finish.
View ImageDescription of this image
You do not need to go through all pages of the Push to Git wizard. Wait for JDeveloper to push all files to the project Git repository. After the Git Push is complete, verify the added files in the Code page of Oracle Developer Cloud Service Web UI.
Creating and Configuring a Build Job in Oracle Developer Cloud Service
In this section you will learn how to configure a build job to run Maven and deploy the archived artifacts.
-
In Oracle Developer Cloud Service web interface, open your project and click Build in the navigation bar.
View ImageDescription of this image -
In the Jobs Overview page, click New Job.
View ImageDescription of this image -
In the New Job dialog, enter
ADF_Maven_Build
as the Job Name and click Save.View ImageDescription of this image -
In the Main tab of Configure build job, select
JDK 8
in JDK.View ImageDescription of this image ADF 12c (12.2.1.0.0) applications require JDK 8.
-
Click the Source Control tab and select the Git option.
View ImageDescription of this image -
In the Repositories section, select the
adf-sample-application.git
Git repository .View ImageDescription of this image -
Click the Environment tab.
View ImageDescription of this image In the Environment tab, select the Connect Oracle Maven Repository check box.
View ImageDescription of this image -
In OTN Login and OTN Password, enter your Oracle Account user name and password.
View ImageDescription of this image -
Click the Build Steps tab.
View ImageDescription of this image -
Click Add Build Step and select Invoke Maven 3.
View ImageDescription of this image -
In the POM File field, specify
WorkBetterFaces/pom.xml
as the path of the POM file.View ImageDescription of this image -
Click the Post Build tab.
View ImageDescription of this image -
In the Post Build tab, select the Archive the Artifacts check box, and specify
WorkBetterFaces/target/*.ear
in Files to Archive.View ImageDescription of this image -
Click Save.
View ImageDescription of this image -
In the ADF_Maven_Build details page, click Build Now.
View ImageDescription of this image -
Wait for the build to complete.
View ImageDescription of this image -
After the build has run, expand Artifacts of Last Build to view the archived artifacts.
View ImageDescription of this image Click
WorkBetterFaces_1.0-SNAPSHOT.ear
to download the EAR file to your local computer and then deploy to your preferred web server.Click the
icon to view the build console. You may want to do that in case of a build failure.
You can also see the build's status in JDeveloper. In the Team Server tab, expand Builds to see the build status of ADF_Maven_Build.
View ImageDescription of this image You might have to refresh the project in Team Server. Mouse over the project name ADF Sample Application and click the Refresh icon.
View ImageDescription of this image
To deploy to Oracle Java Cloud Service, see the Deploying an Application from Oracle Developer Cloud Service to Oracle Java Cloud Service tutorial in the Want to Learn More section.
Want to Learn More?
-
Using Hudson Environment Variables in Using Developer Cloud Service
-
Deploying an Application from Oracle Developer Cloud Service to Oracle Java Cloud Service tutorial
-
Configuring the Oracle Maven Repository in Oracle Fusion Middleware Developing Applications Using Continuous Integration
-
Building Java Projects in Oracle Fusion Middleware Developing Applications with Oracle JDeveloper
-
Deploying Applications in Oracle Fusion Middleware Developing Applications with Oracle JDeveloper