Wednesday, November 18, 2015

Proxy Oracle Maven repository using Artifactory

Oracle have a Maven repository that hosts artifacts and maven plugins for ADF, WebLogic, SOA composites, Toplink, Coherence and other technologies. Repository is at http://maven.oracle.com. A short registration is required for use the repository. You need to login with your OTN account, read and accept the terms of use. Documentation for how to use the repository with JDeveloper and Hudson/Jenkins Continuous Integration (CI) you can find here:
http://docs.oracle.com/middleware/1213/core/MAVEN/introduction.htm#MAVEN8755

As many developers and CI servers use the repository you download from Oracle repository the same artifacts several times. This is a slow process and can bottleneck the external lines. A more effective solution is to use a repository manager and proxy the Oracle Maven repository on the internal network. This way you will download only 1 time each artifact from Oracle Maven repository and speed up the build process on developer machine or on Continuous Integration Servers.



Artifactory is an advanced repository manager. It's open source and have a commercial version with more features. For proxy the Oracle Maven repository the open source version is sufficient. You can download it here:
https://www.jfrog.com/open-source/

For Linux you can download the rpm package.
You can install it and start the service using:

# rpm -i jfrog-artifactory-oss-4.2.2.rpm
# service artifactory start

There is also a docker image if you prefer to use a container and do not install it manually.

The default port for accessing the service is 8081. The first time you can login using admin/password. After you may change the admin password from Admin | Security | Users. You may also set the server name and base URL from Admin | General menu.

Then we can go to Admin | Repositories and configure the Oracle Maven repository as Artifactory Remote Repository. In the Remote Repositories section click New. In the new window in the Repository Key we need to put a unique repository name. After in the General Tab in the URL we enter the Oracle Maven repository URL: https://maven.oracle.com. Also handle releases and handle snapshots need to be checked.


Next in the Advanced settings tab we need to put our OTN username and password for the user we have accept the terms of use for Oracle Maven repository in maven.oracle.com. Also the Lenient Host Authentication and Enable Cookie Management need to be checked.


Then we can click the test button and verify that Artifactory can connect to Oracle Maven Repository.
For expose the repository to users of our Artifactory server we may after create a virtual repository and add the remore repository we already created. In that virtual repository we can combine other repositories like maven central or jcenter and user can use a single internal Maven repository for all artifacts.

Artifactory also provides as the code we need to put to our pom.xml files. We can get that information from Home | Maven settings and then select the virtual repository we want to get a sample code for include it in pom.xml.

Artifactory have a repository browser, a security manager that can limit the access privileges to selected users, can be used for storing the artifacts from maven builds and many more. Its an excellent tool. You can view in their website the rest of the features.


You can also file the Artifactory documentation here:

2 comments:

  1. Hi
    after configuring artifactory (version 4.3.2) remote repository to use Oracle Maven, no artifacts are found in Repository Browser.

    And I have no log (or I do not know where).

    I always have to accept license when accessing Oracle Maven Repository and I do not know why, but I think it's a Oracle problem (as often...)

    Could you help me with this please?
    Regards

    ReplyDelete
    Replies
    1. Create a maven project and set the artifactory as Repository. When the maven project will ask from Artifactory the artifacts it will download them and then you will find them from repository browser. Artifactory will cache the files that you ask from it and not mirror all the Oracle maven repository. Check artifactory documentation for an option to index and search the whole repository. As for licence you only need to accept it one time for your account. Hope this helps.

      Delete

Note: Only a member of this blog may post a comment.