In this post, we will integrate the requisite software to achieve build automation and continuous integration.
- Maven
- Archiva
- Jenkins
- Git
Maven
First, populate the Maven repository.Login as the oracle user. Navigate to the Oracle Maven Sync plug-in location.
cd /u01/fmw/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.3
Install the Oracle Maven Sync plug-in to the local repository.
mvn install:install-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar
Deploy the Oracle Maven Sync plug-in to the EDE repository.
mvn deploy:deploy-file -DpomFile=oracle-maven-sync-12.1.3.pom -Dfile=oracle-maven-sync-12.1.3.jar -Durl=http://ci:8081/repository/ede -DrepositoryId=ede
Populate the EDE repository with Oracle artifacts. This may take awhile, so take a break.
mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=/u01/fmw -Doracle-maven-sync.serverId=ede -U
Update known Maven archetypes for SOA project creation.
mvn archetype:crawl -Dcatalog=/ci/repository/archetype-catalog.xml
Archiva
The sar-common artifact contains reusable attributes that are common to all SOA projects; therefore, it needs updated.Login to Archiva as the admin user.
Click Browse and navigate to the EDE repository.
Navigate to the com.oracle.soa.sar-common artifact.
Click Artifacts and click the download artifact image.
Save the file and edit the <oracleServerUrl>, <oracleServerName>, and <oracleMiddlewareHome> elements according to your environment. For the purpose of this article, the username and password for the Weblogic server are left in plain text. These tokens can be encrypted by following these instructions.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.oracle.soa</groupId> | |
<artifactId>sar-common</artifactId> | |
<version>12.1.3-0-0</version> | |
<packaging>pom</packaging> | |
<parent> | |
<groupId>com.oracle.maven</groupId> | |
<artifactId>oracle-common</artifactId> | |
<version>12.1.3-0-0</version> | |
<relativePath></relativePath> | |
</parent> | |
<properties> | |
<!-- | |
These two properties are defined in com.oracle.maven:oracle-common, you can overwrite them here. | |
Users who do not want to add plain text password in their properties or pom file, should use the userConfigFile | |
and userKeyFile options for deployment. | |
<oracleUsername>weblogic</oracleUsername> | |
<oraclePassword>welcome1</oraclePassword> | |
--> | |
<!-- Change the default values according to your environment --> | |
<oracleServerUrl>http://ci:8001</oracleServerUrl> | |
<oracleServerName>soa_server1</oracleServerName> | |
<oracleMiddlewareHome>/u01/fmw</oracleMiddlewareHome> | |
</properties> | |
</project> | |
Click Upload Artifact to persist the modified artifact to the repository. Provide the coordinates for sar-common. Click Choose File and select the modified pom. Mark the pomFile checkbox and click Start Upload.
Click Save File.
Browse to the artifact and view the updated contents.
Jenkins
Create an automated build that will be kicked off when a push to the repository occurs.Login to Jenkins as the admin user.
Click create new jobs.
Provide a name for the job, and select the Maven project radio button. Click Ok.
In the Source Code Management section, select the Git radio button. Provide the repository URL:
/ci/git/demo.git
In the Build Triggers section, unmark the Build whenever a SNAPSHOT dependency is built checkbox. Mark the Poll SCM checkbox. Do not specify a schedule.
In the Build Environment section, mark Provide Configuration files. In the File dropdown, ensure that the settings file created earlier in the Configuration post is selected. Provide the variable to indicate the deployment target environment as EDE:
env=ede
In the Build section, provide the Goals and options:
clean deploy
Click Save.
Git
Determine if the post-commit hook created in the previous Configuration article will execute when a push to the repository occurs. Navigate to the following URL:http://ci:8080/git/notifyCommit?url=file:///ci/git/demo.git
The page should render:
Scheduled polling of Demo
Test Maven Manually (optional)
Maven can be tested manually by navigating to the project directory where the SOA folder resides.
Run the Maven with the clean objective.
mvn clean
Maven will resolve dependencies from Archiva, and after some time, the build succeeds.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:14 min
[INFO] Finished at: 2015-10-12T13:11:59-04:00
[INFO] Final Memory: 15M/80M
[INFO] ------------------------------------------------------------------------
No comments:
Post a Comment