oracle - 尝试访问 Oracle 的 Maven 存储库

标签 oracle maven repository

我正在尝试访问 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
    

    尽管我接受了许可协议(protocol)并且正在使用我创建的帐户,但我似乎无权访问 Oracle 存储库。有什么我想念的吗?如果我在我的 pom.xml 中删除对 wls-api.jar 的引用, 有用。

    最佳答案

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

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

    关于oracle - 尝试访问 Oracle 的 Maven 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30854636/

    相关文章:

    Git 从本地存储库中删除上游

    java - JDBC 与 Oracle DB - 使用类似条件的参数标记

    .net - Oracle ODP.NET 版本不可知的替代方案

    java - 本地存在 Maven 依赖项时出现 NoClassDefFoundError

    Java 9 的 Maven 编译问题

    linq - 处理具有多个具体实现的存储库模式中的查询?

    oracle - 插入时可以在表上创建索引

    sql - 动态 SQL 或 WITH 子句

    android - 无法访问继承的库

    c# - 将 SimpleDB(与 SimpleSavant)与 POCO/现有实体一起使用,而不是我类上的属性