Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to access Oracle's Maven repository

I'm attempting to access Oracle's repository. Oracle doesn't make it easy. However, I'm attempting to follow the documentation that Oracle provided.

I've:

  • Approved the licensing agreement on my system (in case there's some sort of cookie that needs to be set).
  • Set both M2_HOME and MAVEN_HOME to /usr/share/apache-maven.
  • Created an Oracle account.
  • Added the Oracle Repository to my settings.xml file.
  • Downloaded wagon-http 2.8 and put it in my $M2_HOME/libs/ext directory.
  • Generated a master password and put it in $HOME/.m2/settings-security.xml
  • Generated an encrypted password.
  • Added the Oracle Maven Repository to my $HOME/.m2/settings.xml file as specified.
  • Configured HTTP Wagon and added that to my $HOME/.m2/settings.xml file.

My project POM looks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.vegicorp</groupId>
    <artifactId>testMe</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>testMe</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>wls-api</artifactId>
            <version>12.1.2</version>
        </dependency>
    </dependencies>
</project>

My settings.xml looks like this:

<?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">
    <servers>
        <server>
            <username>qazwart</username>
            <password>swordfish</password>
            <id>central</id>
        </server>
        <server>
            <username>qazwart</username>
            <password>swordfish</password>
            <id>snapshots</id>
        </server>
        <server>
            <id>maven.oracle.com</id>
            <username>[email protected]</username>
            <password>{swordfish=}</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>
    </servers>
    <profiles>
        <profile>
            <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>
                <repository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>central</id>
                    <name>libs-release</name>
                    <url>http://repo.vegicorp.net/artifactory/libs-release</url>
                </repository>
                <repository>
                    <snapshots />
                    <id>snapshots</id>
                    <name>libs-snapshot</name>
                    <url>http://repo.vegicorp.net/artifactory/libs-snapshot</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>maven.oracle.com</id>
                    <url>https://maven.oracle.com</url>
                </pluginRepository>
                <pluginRepository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>central</id>
                    <name>plugins-release</name>
                    <url>http://repo.vegicorp.net/artifactory/plugins-release</url>
                </pluginRepository>
                <pluginRepository>
                    <snapshots />
                    <id>snapshots</id>
                    <name>plugins-snapshot</name>
                    <url>http://repo.vegicorp.net/artifactory/plugins-snapshot</url>
                </pluginRepository>
            </pluginRepositories>
            <id>artifactory</id>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>artifactory</activeProfile>
    </activeProfiles>
</settings>

When I run Maven, I get this:

$ mvn clean package                                                                            
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building testMe 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://maven.oracle.com/commons-io/commons-io/2.4/commons-io-2.4.pom
Downloading: http://repo.vegicorp.net/artifactory/libs-release/commons-io/commons-io/2.4/commons-io-2.4.pom
Downloaded: http://repo.vegicorp.net/artifactory/libs-release/commons-io/commons-io/2.4/commons-io-2.4.pom (10 KB at 69.4 KB/sec)
Downloading: https://maven.oracle.com/com/oracle/wls-api/12.1.2/wls-api-12.1.2.pom
Downloading: http://repo.vegicorp.net/artifactory/libs-release/com/oracle/wls-api/12.1.2/wls-api-12.1.2.pom
Downloading: http://repo.vegicorp.net/artifactory/libs-snapshot/com/oracle/wls-api/12.1.2/wls-api-12.1.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.787 s
[INFO] Finished at: 2015-06-15T16:37:56-04:00
[INFO] Final Memory: 9M/156M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project testMe: Could not resolve dependencies for project com.vegicorp:testMe:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.oracle:wls-api:jar:12.1.2: Failed to read artifact descriptor for com.oracle:wls-api:jar:12.1.2: Could not transfer artifact com.oracle:wls-api:pom:12.1.2 from/to maven.oracle.com (https://maven.oracle.com): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

It appears that I don't have access to the Oracle repository although I accepted the licensing agreement and am using the account I've created. Is there something I'm missing? If I remove the reference to wls-api.jar in my pom.xml, it works.

like image 863
David W. Avatar asked Jun 15 '15 20:06

David W.


People also ask

How do I browse a Maven repository?

To browse the content of central maven repository, maven community has provided a URL − https://search.maven.org/#browse. Using this library, a developer can search all the available libraries in central repository.

What is the default Maven repository URL?

By default, Maven will always look in the official Maven repository, which is http://repo1.maven.org. When Maven tries to build a project, it will look in your local repository (by default ~/. m2/repository but you can configure it by changing the <localRepository> value in your ~/. m2/settings.

Where is the Maven repository?

Custom Local Repository in settings. That config file is located in the Maven installation directory in a folder called conf, with the name settings. xml.

What is the Maven repository?

A repository in Maven holds build artifacts and dependencies of varying types. There are exactly two types of repositories: local and remote: the local repository is a directory on the computer where Maven runs. It caches remote downloads and contains temporary build artifacts that you have not yet released.


2 Answers

From your settings.xml I can see that you use Artifactory. Why won't you define Oracle's repository as a remote in Artifactory? That will make the access much easier. Here's a simple guide on how to do so.

And, of course, here's the official user guide on it.


I am with JFrog, the company behind Bintray and [artifactory], see my profile for details and links.

like image 72
JBaruch Avatar answered Nov 15 '22 05:11

JBaruch


For anybody that has spent any time fighting with this ... make sure that the ID of the oracle repository in your POM is the same as the ID of the server defined in your Settings.xml.

This is not documented anywhere but it appears that maven just does not request authorization if these IDs do not match. It does not attempt it based upon the URL as other solutions appear to suggest.

like image 37
Alastair Knowles Avatar answered Nov 15 '22 03:11

Alastair Knowles