This post will demonstrate how to setup and build an Oracle ATG Commerce application in Oracle Developer Cloud Service (devCS).
There are multiple ways to accomplish several steps described in this post. Things will intentionally be shown in a way to help give an understanding of how to accomplish tasks in a variety of environment configurations.
To build ATG applications, a product installation is required. At the time of creating this post, the Oracle Developer Cloud build environment has ATG 11.1 patch 1 libraries embedded in it. To build with other versions/patch levels of the ATG Commerce stack, additional steps are required not included in this post. Additional information on building with other versions will come in the future.
You can actually add builds to devCS with code from other versions of ATG. And you can upload libraries from other versions of ATG to your devCS maven repository. The code will likely build fine. However, this is not recommended for anything other than development purposes (not to be used with a production deployment).
ATG is installed locally – version 11.1 or greater
Maven 3.x installed locally
GIT client installed locally
You have a Oracle Developer Cloud Service (devCS) domain
All steps in this post executed locally are assumed to be in your environment containing the ATG and Maven installations.
export DYNAMO_ROOT=/u02/atg11.1 export DYNAMO_HOME=$DYNAMO_ROOT/home export ATG_ROOT=$DYNAMO_ROOT export ATG_HOME=$ATG_ROOT/home
mvn clean install
ATGDust should now be built, and installed in your local maven repository. ATG applications built with maven will now be able to execute ATGDust test cases.
Note – if you have not used maven much in the past, it is likely to download a large number of libraries the first time you use it. These will be cached locally after the initial download. Installing ATGDust locally is a one time setup step. Once it is in your local maven repository, this never has to be done again for future projects (unless it gets deleted from your maven repository).
mvn clean install
For more information on ATGDust and the sample application and test cases included, refer to the PDF document that was in the ATGDust archive.
Log in to your devCS environment and create a new project. Name it atgbuilddemo.
On your local server, clone the GIT repository created with your project. This will be on the project tab of your devCS console.
To clone the repository, execute:
git clone https://username.username%40oracle.com@developer.us2.oraclecloud.com/developer41561-atgdemo/s/developer41561-atgdemo_atgbuilddemo_19815/scm/atgbuilddemo.git .
Replace the URL with the value you obtained from your devCS project.
The directory you clone this into will be called GIT_ROOT for this post.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <servers> <server> <id>atgbuildrepo</id> <username>devcs-USERNAME</username> <password>devcs-PASSWORD</password> </server> </servers> <profiles> <profile> <id>default</id> <repositories> <repository> <id>atgbuildrepo</id> <name>ATGBuild Maven Repository</name> <url>https://developer.us2.oraclecloud.com/profile/developer36822-ateamatgpoc3/s/developer36822-ateamatgpoc3_atgbuild/maven/</url> <layout>default</layout> </repository> </repositories> </profile> </profiles> </settings>
This file allows you to execute maven commands against your devCS environment, while automatically passing in login credentials.
Just like you did locally, you need to add ATG product libraries to your devCS environment so they are available to your code at build time.
Download sample script to push libraries to remove maven repo here:
You can look at the sample script provided, but the general format for adding files to a remote maven repository is:
mvn deploy:deploy-file \ -DgroupId=atg \ -DartifactId=webui-preview-1_0 \ -Dpackaging=jar \ -Dversion=${ATG_VERSION} \ -Dfile=${DYNAMO_ROOT}/WebUI/Preview/taglibs/webui-preview/lib/webui-preview-1_0.jar \ -DrepositoryId=${REPO_ID} \ -Durl=${REMOTE_URL}
Just like you added ATGDust to your local maven repository, you need to add it to your devCS maven repository.
Instead of building the code in devCS, we are going to deploy the built code from the local environment to the devCS environment.
<distributionManagement> <repository> <id>atgbuildrepo</id> <url>https://developer.us2.oraclecloud.com/profile/developer41561-atgdemo/s/developer41561-atgdemo_atgbuilddemo_19815/maven</url> </repository> </distributionManagement>
This tells maven where to send your built maven artifacts when you use the deploy command.
Now deploy ATGDust to your devCS maven repo by executing:
mvn deploy
You can verify the deployment by going to the maven menu item in your devCS console. You should see an item that looks like "com/…/1.3.1" Click on the 1.3.1, and you should see the ateamDust artifact.
Example:
<repositories> <repository> <id>atgbuildrepo</id> <name>atgbuildrepo</name> <url>https://developer.us2.oraclecloud.com/profile/developer41561-atgdemo/s/developer41561-atgdemo_atgbuilddemo_19815/maven</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>atgbuildrepo</id> <name>atgbuildrepo</name> <url>https://developer.us2.oraclecloud.com/profile/developer41561-atgdemo/s/developer41561-atgdemo_atgbuilddemo_19815/maven</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> <distributionManagement> <repository> <id>atgbuildrepo</id> <url>https://developer.us2.oraclecloud.com/profile/developer41561-atgdemo/s/developer41561-atgdemo_atgbuilddemo_19815/maven</url> </repository> </distributionManagement>
Go to the build tab in your devCS console and click new job. Name the job ATGTest.
The build is now configured to build in manual mode. You have to initiate a build through the devCS console.
If you want to make build automatic – for example when a commit of code occurs:
Go to the ATGTest build. Click configure.
Go to triggers
Select based on SCM polling schedule
Leave schedule blank. When you commit to the git repo, a build will be kicked off.
Example:
You can now work on your code locally. Whenever you commit to your git repository, the code is pushed to your devCS instance. If you leave the SCM Polling Schedule enabled, the build will occur automatically.
If you want to integrate development with an IDE, like Eclpise, just import an existing maven project.
In eclipse – select import -> Maven -> Existing Maven Projects
Click next
Navigate to the ATeam folder you pushed to devCS. This will be in the root of your git clone you created earlier.
Leave on defaults. All boxes should be checked. Click finish.
Your sample build should now be imported. You should have 3 projects, corresponding to the 3 pom files in the build. One top level, one for ATeamCommon, and one for ATeamWebApp.
You project is also linked up to your remote GIT repository now. You can commit and push from eclipse, and your changes will be added to your devCS environment.