试图访问Oracle的Maven存储库

时间:2015-06-15 20:43:36

标签: oracle maven repository

我试图访问Oracle的存储库。 Oracle并不容易。但是,我试图关注Oracle提供的the documentation

我'已经:

  • 在我的系统上批准了the licensing agreement(如果需要设置某种类型的Cookie)。
  • M2_HOMEMAVEN_HOME设置为/usr/share/apache-maven
  • 创建了一个Oracle帐户。
  • 将Oracle存储库添加到我的settings.xml文件中。
  • 下载wagon-http 2.8并将其放入我的$M2_HOME/libs/ext目录。
  • 生成主密码并将其放入$HOME/.m2/settings-security.xml
  • 生成加密密码。
  • 将Oracle Maven存储库添加到我的$HOME/.m2/settings.xml文件as specified
  • 已配置HTTP Wagon并将其添加到我的$HOME/.m2/settings.xml文件中。

我的项目POM看起来像这样:

<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>

我的settings.xml看起来像这样:

<?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>qazwart@foo.com</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>

当我运行Maven时,我明白了:

$ 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

虽然我接受了许可协议并使用了我创建的帐户,但我似乎无法访问Oracle存储库。有什么我想念的吗?如果我删除了pom.xml中对wls-api.jar的引用,则可以正常工作。

3 个答案:

答案 0 :(得分:1)

settings.xml我可以看到你使用Artifactory。为什么不能将Oracle的存储库定义为Artifactory中的远程存储库?这将使访问更容易。 Here's a simple guide on how to do so

当然还有here's the official user guide on it

我与JFrogBintray [artifactory]背后的公司,请参阅my profile了解详细信息和链接。

答案 1 :(得分:0)

我认为您错过了接受Oracle Maven存储库条款和条件。 https://www.oracle.com/webapps/maven/register/license.html

答案 2 :(得分:0)

对于任何与此争吵的人...确保POM中oracle存储库的ID与Settings.xml中定义的服务器的ID相同。

这在任何地方都没有记录,但如果这些ID不匹配,maven似乎不会请求授权。它没有像其他解决方案似乎建议的那样基于URL进行尝试。