Oracle recently released Maven Repository which is a giant leap in adopting Maven too for building, packaging and deploying SOA, ADF applications. You can access the repository here. To access this, you should be registered user with Oracle and accept the licensing terms.
In this post, we will see how to setup Archiva repositories and populate it with artifacts from Oracle Home. You can refer to Oracle FMW Continuous Integration documentation here for more information.
You can download the latest version of Archiva from here and corresponding documentation can be found here.
Archiva installation is so simple and you have to just unzip file contents. The standalone distribution comes up with bundled jetty server. By default, the server uses port 8000. You can always change this port to your desired value as shown below by modifying jetty.xml in conf directory.
Navigate to bin directory and start the server using the following command:
archiva console
Once the server started, launch archiva using url http://localhost:8088. The first step is to create the admin user as shown below, so CreateAdmin User on the page launched. Enter the password and email and do Save.
Now login using Admin credentials and navigate to Repositories which shows 2 default repositories as shown below.
By default, the internal repository is for maintaining the fixed-version released artifacts includes finished versions of artifacts, versions that are no longer in development, and released versions. And the snapshot repository holds the work-in-progress artifacts denoted with a version having suffix SNAPSHOT
, and artifacts that have not yet been released.
Here, we will create repositories keeping development environment in mind. It’s always recommended to create different repositories for DEV, QA and PROD as there is possibility of having different versions of same artifacts. For our purpose, we will reuse the snapshots repository and create 2 repositories mirror and dev. The mirror repository is used to cache third-party proxied artifacts and dev is used similar as internal repository.
Navigate to Repositories link and click Add. Set the properties similar to below.
Click Save to go back to Managed Repositories page as shown below and here you can observe the new mirror repository.
Create dev repository in similar way and make sure that you uncheck Block Redeployments as shown below.
Archiva has a provision to create Repository Groups, that allows to specify single URL instead of multiple repository URLs when we are using more than 1 repository.
Here we will create a repository group dev-group consisting of all the above. Navigate to Repository Groups and click Add.
Give the name as dev-group and drag dev, snapshots and mirror repositories from Available list to left as shown below.
Click Save and observe the repository group as shown below.
Archiva uses proxy connector to link local repository with a remote repository. So when a request is received by repository, the connector decides whether it should request artifact from remote repository and cache the result locally for future requests.
By default, internal repository is connected to remote repository using Proxy Connector. This you can observe by navigating to Proxy Connectors as shown below.
Since we want our mirror repository to proxy remote repository, delete the existing proxy connector. Click Add and create new Proxy Connector as shown below. Observe that Managed Repository is selected as mirror. Click Save.
With this, you have finished setting up required Archiva repositories.
By default, Oracle FMW installation comes up with Maven 3.0.5 and is available in following location. So set M2 and M2_HOME system variables accordingly.
%MW_HOME%\oracle_common\modules\org.apache.maven_3.0.5
Using Oracle Maven Sync Plugin
Navigate to the directory %MW_HOME%\oracle_common\plugins\maven\ com\oracle\ maven\oracle-maven-sync\12.1.3.
Install plugin:
mvn install:install-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom
Use the following as your user specific maven settings. Remember to modify the passwords in server elements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<profiles> | |
<profile> | |
<id>default</id> | |
<repositories> | |
<repository> | |
<id>dev-group</id> | |
<name>Dev Group</name> | |
<releases> | |
<enabled>true</enabled> | |
<updatePolicy>always</updatePolicy> | |
<checksumPolicy>warn</checksumPolicy> | |
</releases> | |
<snapshots> | |
<enabled>false</enabled> | |
<updatePolicy>never</updatePolicy> | |
<checksumPolicy>fail</checksumPolicy> | |
</snapshots> | |
<url>http://localhost:8088/repository/dev-group</url> | |
<layout>default</layout> | |
</repository> | |
<repository> | |
<id>dev</id> | |
<name>Dev</name> | |
<releases> | |
<enabled>true</enabled> | |
<updatePolicy>always</updatePolicy> | |
<checksumPolicy>warn</checksumPolicy> | |
</releases> | |
<snapshots> | |
<enabled>false</enabled> | |
<updatePolicy>never</updatePolicy> | |
<checksumPolicy>fail</checksumPolicy> | |
</snapshots> | |
<url>http://localhost:8088/repository/dev</url> | |
<layout>default</layout> | |
</repository> | |
<repository> | |
<id>snapshots</id> | |
<name>Archiva Managed Snapshot Repository</name> | |
<releases> | |
<enabled>false</enabled> | |
<updatePolicy>always</updatePolicy> | |
<checksumPolicy>warn</checksumPolicy> | |
</releases> | |
<snapshots> | |
<enabled>true</enabled> | |
<updatePolicy>never</updatePolicy> | |
<checksumPolicy>fail</checksumPolicy> | |
</snapshots> | |
<url>http://localhost:8088/repository/snapshots</url> | |
<layout>default</layout> | |
</repository> | |
</repositories> | |
</profile> | |
<servers> | |
</server> | |
<server> | |
<id>dev</id> | |
<username>admin</username> | |
<password>password</password> | |
</server> | |
<server> | |
<id>dev-group</id> | |
<username>admin</username> | |
<password>password</password> | |
</server> | |
<server> | |
<id>snapshots</id> | |
<username>admin</username> | |
<password>password</password> | |
</server> | |
</servers> | |
<activeProfiles> | |
<activeProfile>default</activeProfile> | |
</activeProfiles> | |
</settings> |
Deploy plugin to dev Repository:
mvn deploy:deploy-file -Dfile=oracle-maven-sync-12.1.3.jar -DpomFile=oracle-maven-sync-12.1.3.pom -Durl=http://localhost:8088/repository/dev -DrepositoryId=dev
Verifying Sync plugin:
mvn help:describe -Dplugin=com.oracle.maven:oracle-maven-sync –Ddetail
Do the Sync:
mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=%MW_HOME% -DserverId=dev
You can verify the synced artifacts in dev repository as shown below
Verifying SOA plugin
mvn help:describe -DgroupId=com.oracle.soa.plugin -DartifactId=oracle-soa-plugin -Dversion=12.1.3-0-0
Verifying Service Bus plugin
mvn help:describe -DgroupId=com.oracle.servicebus.plugin -DartifactId=oracle-servicebus-plugin -Dversion=12.1.3-0-0
Note: Use double quotes in the maven commands like below if you are seeing the error mentioned in this link.
mvn install:install-file “-DpomFile=oracle-maven-sync-12.1.3.pom” “-Dfile=oracle-maven-sync-12.1.3.jar” “-DoracleHome=C:/Oracle/Middleware/FMW1213New”
1 Response to “SOA 12c – Using Maven Sync Plugin”