The Oracle Developer Cloud Service (DevCS) is a cloud-based software development Platform as a Service (PaaS) and a hosted environment for your application development infrastructure. It provides an open source standards-based solution to develop, collaborate on, and deploy applications within Oracle Cloud. Some of the core features offered by DevCS include a hosted GIT repository, a Maven repository, Issue Tracking capabilities, a Hudson Continuous Integration (CI) server, Wiki collaboration, code-review, roles and responsibilities separation, and many more. The complete list of features is available here.
While the documentation of all these features is available at http://docs.oracle.com/cloud/latest/devcs_common/index.html , in this blog we'll concentrate on the Maven aspect of DevCS. Specifically, we'll describe how one can :
Developer Cloud Service lets you create a number of 'projects'. With each project, an instance of Hudson CI Server, a GIT repository, a Maven Repository and a Wiki server are allotted. Below is a snapshot of the DevCS project home page:
The environment specific data has been redacted from the images in this blog.
It can be seen above that there are two git repositories attached to the project. DevCS allows a number of GIT repositories, both hosted and external, to be attached to a project. This provides flexibility to the Project Management team within your organization to logically separate projects as needed. The GIT Repositories can be managed via the Admin tab, where the result is shown below :
In this section we will go through the steps to populate the DevCS Maven repository with the Weblogic 12.1.2 libraries, although the steps are valid for any version of Weblogic 12c.
Since the Weblogic libraries are Oracle copyrighted, care must be taken to ensure the libraries aren't publicly accessible. Since a DevCS Maven repository is protected via HTTP Authentication, it's OK to upload the libraries there.
The entire process can be divided into three main steps :
Setting up Maven on a local machine.
Installing Weblogic binaries on the local machine.
Pushing the local binaries to the remote Maven repository.
Before starting the upload, it is important to consider the network latency and upload speed to ensure the upload happens as quickly as possible.
Also, if a large number of libraries are to be uploaded, it is worth considering a VNC type session, so that session interruptions do not interfere with the upload.
Download and install the apache-maven-3.x.x (we used 3.0.5) on the local Machine (say a linux VM).
Open MVN_HOME/conf/settings.xml and make the following changes.
Under the ‘proxies’ section, specify the appropriate proxy, as given below:
Under the ‘servers’ section, specify a remote Maven server called remoteRepository. This will hold the username/password details when connecting to the ‘remoteRepository’, i.e. our DevCS Maven Repository :
The DevCS Maven Repository is protected, and only users who have access to the project can view the associated repository. The authentication mechanism is basic HTTP. The username/password above will be used for authentication before the upload.
Under the ‘profiles’ section, specify the default value of ‘remoteRepository’, as mentioned below:
The 'url' above can be found on the DevCS home page, as seen in the above image. Also note the 'dav:' in the URL, signifying that the upload will use the WebDAV protocol.
Make sure the default profile is activated :
Download the Weblogic 12.1.2 'Zip distribution for Mac OSX, Windows, and Linux’ from Oracle Technology Downloads . We used the zip distribution only for demonstration purposes, any other type of installation would work as well.
Unzip the downloaded file to any location (eg: /home/myhome/mywls ).
Set JAVA_HOME and MW_HOME, eg :
Run MW_HOME/configure.sh . This unpacks all the jar files
On the local VM, ensure MVN_HOME/bin is available in the $PATH variable
‘cd’ to location ‘/home/myhome/mywls/wls12120/oracle_common/plugins/maven/com/oracle/maven/oracle-maven-sync/12.1.2’
Create a file, pom.xml , with the following content :
The above pom.xml declares the wagon webdav plugin to be part of the mvn context. This library is used for uploading content to the remote repository using the WebDAV protocol.
Run the command :
This populates the local Maven repository, and deploys the file oracle-maven-sync.12.1.2.jar, its associated pom, and the MD5 and SHA1 hash of each to the remote repository specified by the -Durl parameter. The -DrepositoryId is used to pick up the authentication information from settings.xml (which we set above in Section a.2).
Run the command :
This command invokes the 'Oracle Maven Synchronization Plugin', specifically the coordinate com.oracle.maven:oracle-maven-sync:push , which uploads the local weblogic jars to the remote repository. This command recursively traverses through various dependencies and uploads them all. Depending on the network connection/upload speed, this may take a couple of hours.
Please note that this command uses the pom.xml file defined in step#iii above.
We assume that the source java project is checked into the DevCS GIT repository.
The following pom.xml can be used for compiling and packaging the project. It must also be checked into the GIT repository.
The things to note are :
The com.oracle.weblogic and junit dependencies
Maven compiler plugin which lets us specify the -source and -target options while using javac (optional)
Maven Repository url that specifies the location of the Weblogic libraries (i.e. the repository we just populated)
Below are the steps for setting up the Hudson build and deployment options on DevCS:
On the DevCS project home page, click on the 'Build' tab, and create a new job
Name the new job. On the configurations page, set the following :
Git Repository details
Create a Maven 3 Build Step and specify 'clean package' as the goals. Also ensure the pom.xml file is specified correctly.
In the post-build step check the 'Arhive the artifacts' option, specifying the file(s) to be archived, as shown below . The archived file(s) will be used to deploy the generated artifacts to the associated JCS-SX instance.
Save the job. Run it once to make sure the build executes successfully
Go to the 'Deploy' tab and create a new Deployment Configuration :
The options in the image above are self-explanatory. The application ‘TestConfiguration’ is to be deployed to the JCS-SX instance ‘jcssx02′. The artifacts generated from the specific Hudson job and build number are deployed to the 'jcssx02' instance. One can also schedule an Automatic deployment (as compared to ‘On Demand’) on every successful Hudson build.
We've demonstrated how to use the Developer Cloud Service to automate your Maven based development lifecycle. We saw how the Maven Repository can be populated with weblogic or other custom jars, and how the Hudson build jobs and deployments can be configured.
We'd be remiss if we didn't mention the newly introduced Oracle Maven Repository . Steve Button explains it nicely in his blog https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle . Efforts are underway to make the Oracle Maven Repository work with DevCS. More on that when we have more information.