Tuesday, August 4, 2015

How to Use The Oracle Maven Repository

With the push of a lot of the 12c Series of products Oracle released it's own Maven repository. They made it functionally public a number of months ago, and I have been able to use it without incident since that time. Along with their release of the repository were instructions on how to use it here. The instructions however over explained in some areas and were a little convoluted in others. As a result I have decided to release a straight forward set of instructions.

Step 0: Maven Configurations
Of course I would say that it's going to be straight forward and then make things a little convoluted. As a matter of preference I like to keep my settings local to me rather than in the global settings file for maven that way between maven upgrades or in a shared environment I can bring my settings with me.

Global Maven Settings are stored in:
  Linux/Mac: $M2_HOME/conf/settings.xml
  Windows: %M2_HOME%\conf\settings.xml

Personal Settings are stored in:
  Linux/Mac: ~/.m2/settings.xml
  Windows: C:\Documents and Settings\<your-username>\.m2\settings.xml

If you want to start your own personal settings file the easiest way is to copy the it from the global. For the remainder of this tutorial I will assume you're working with Personal Settings

Step 1: Setup Maven Security
When connecting to authenticated Maven repositories you need to put your passwords into either your project POM file or into your settings.xml files. Either way your passwords and on your filesystem. To get this started first a master password needs to established and then your passwords in the future can be encrypted. Luckily Apache has a very simple article documenting these steps http://maven.apache.org/guides/mini/guide-encryption.html

Step 2: Configure Server
In the settings.xml add the following to the <servers> section:
          <realm>OAM 11g</realm>
In place of the {USERNAME} should be your OTN email, and in place of {/ENCRYPTED_PASSWORD} should be the encrypted version of your password which you should now know how to generate from the Apache guide.

Step 3: Configure Profile
In the settings.xml add the following to the <profiles> section:

Step 5: Accept Terms and Conditions
With Oracle of course anything you want to download from them there is some sort of agreement, and the Maven Repository is not different. At lease with this one you only need to do it once. Go to https://www.oracle.com/webapps/maven/register/license.html and accept the terms.

Provided that you followed all of these steps you should easily be able use oracle libraries as dependencies in your next project.

1 comment:

JAVAMAN said...

I try to connect to the MAVEN ORACLE REPOSITORY and made all these steps, but the error that i got was:

"Not authorized , ReasonPhrase:Unauthorized".