6 Configuring the Oracle Maven Repository

The Oracle Maven Repository contains artifacts provided by Oracle that you may require to compile, test, package, perform integration testing, or deploy reapplications. The following topics provide information about accessing and configuring Oracle Maven Repository:

6.1 Accessing the Oracle Maven Repository

To access the Oracle Maven Repository, you must first register for access on Oracle Technology Network. You can access the registration application at:

https://www.oracle.com/webapps/maven/register/license.html

This application displays the license agreement for access to the Oracle Maven Repository. You must accept the license agreement to access the Oracle Maven Repository.

Every time you want to access the Oracle Maven Repository, you must provide the user name and the password you used to log in to Oracle Technology Network (OTN). Access is only provided over HTTPS. You can store your credentials in the Maven settings file so that you do not have to specify them manually every time. Oracle recommends that you encrypt your password, using the utilities provided with Maven.

To access the Oracle Maven Repository, you must use Maven 3.0.4 or later and make a few modifications to your Maven settings and project POM, as described in Section 6.3, Section 6.4, and Section 6.5.

Note that due to changes made in Maven 3.1, some Maven plugins developed for Maven 3.0.n may not work properly with Maven 3.1.n (or later). Oracle recommends that you use the version of Maven recommended by your particular Oracle Fusion Middleware release.

6.2 Artifacts Provided

Oracle Maven Repository provides only release-level artifacts, such as 12.1.2 and 12.1.3. If a patch is required, please obtain the patch from Oracle Support, apply it to a local Oracle Home installation, and use the Maven Synchronization plug-in to update your local Maven repository.

6.3 Adding the Oracle Maven Repository to Your Project POM

Add a repository definition to your Maven settings.xml file or to your Maven Project Object Model (POM) files, or both. The repository definition should look like the following:

<repositories>
  <repository>
    <id>maven.oracle.com</id>
    <releases>
      <enabled>true</enabled>
    </releases>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
    <url>https://maven.oracle.com</url>
    <layout>default</layout>
  </repository>
</repositories>
<pluginRepositories>
  <pluginRepository>
    <id>maven.oracle.com</id>
    <url>https://maven.oracle.com</url>
  </pluginRepository>
</pluginRepositories>

6.4 Configure Maven to Use a Compatible HTTP Wagon

By default, Maven uses the wagon-http component to access remote repositories including the Oracle Maven Repository. Since the Oracle Maven Repository is protected by Oracle's Single Sign-On (SSO) technology, the Oracle Maven Repository requires a version of the wagon-http component that supports authentication with an enterprise-grade SSO solution. Prior to wagon-http version 2.8, the wagon-http component did not support the necessary configuration to be able to handle SSO-style authentication. As such, the Oracle Maven Repository requires the use of wagon-http 2.8 (or later).

By default, Maven picks up the version of the wagon-http from the local Maven installation. As of Maven 3.2.5, the wagon-http version included in the Maven distribution is wagon-http version 2.8.

Users of older versions of Maven can configure Maven to use wagon-http version 2.8 by adding the wagon-http 2.8 version:

  1. Download the wagon-http 2.8 shaded JAR file from Maven Central:

    http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar
    
  2. Move that JAR file to the following directory:

    MAVEN_HOME/lib/ext/ 
    

6.5 Configuring the HTTP Wagon

The Maven settings.xml requires additional settings to support the Oracle Maven Repository. Add the following <server> element to the <servers> section of the Maven settings.xml:

 <server>
    <id>maven.oracle.com</id>
    <username>username</username>
    <password>password</password>
    <configuration>
      <basicAuthScope>
        <host>ANY</host>
        <port>ANY</port>
        <realm>OAM 11g</realm>
      </basicAuthScope>
      <httpConfiguration>
        <all>
          <params>
            <property>
              <name>http.protocol.allow-circular-redirects</name>
              <value>%b,true</value>
            </property>
          </params>
        </all>
      </httpConfiguration>
    </configuration>
  </server>

Replace the <username> and <password> entries with your OTN user name and password. Oracle strongly recommends that you encrypt your password using the standard Maven encryption mechanisms, as described in the following:

http://maven.apache.org/guides/mini/guide-encryption.html

6.6 Considerations for Using the Oracle Maven Repository with Maven Without a POM

When you invoke Maven from the command-line to run a plugin goal directly, Maven uses a standalone POM that does not use the repositories listed in the settings.xml file unless they are part of a profile that is set to be "active by default". For example, the typical way to generate a new project from an archetype is to invoke the Maven's archetype:generate goal from the command line directly without a project POM in place. In order for this to work, the Oracle Maven Repository must be declared within a profile that is active by default, as shown in the following example:

<profiles>
    <profile>
      <id>main</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>maven.oracle.com</id>
          <url>https://maven.oracle.com</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
          </releases>
        </repository>
      </repositories>
    </profile>
  </profiles>

6.7 Accessing the Oracle Maven Repository from an Automated Build Tool

If you wish to access the Oracle Maven Repository from an automated build tool, such as Hudson Continuous Integration server, you may wish to encrypt your password and store it in your Maven settings-security.xml file.