Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven正在尝试从私有存储库安装每个jar_Java_Maven_Amazon S3 - Fatal编程技术网

Java Maven正在尝试从私有存储库安装每个jar

Java Maven正在尝试从私有存储库安装每个jar,java,maven,amazon-s3,Java,Maven,Amazon S3,我在S3中有一个私有存储库,用于发布一个库,然后在另一个项目中使用 要发布,我有以下设置: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId>

我在S3中有一个私有存储库,用于发布一个库,然后在另一个项目中使用

要发布,我有以下设置:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>

    <extensions>
        <extension>
            <groupId>com.allogy.maven.wagon</groupId>
            <artifactId>maven-s3-wagon</artifactId>
            <version>1.1.0</version>
        </extension>
    </extensions>
</build>

<distributionManagement>
    <repository>
        <id>projectx-aws-release</id>
        <name>ProjectX AWS Release Repository</name>
        <url>s3://projectx-support/maven2</url>
    </repository>
    <snapshotRepository>
        <id>projectx-aws-snapshots</id>
        <name>Projectx AWS Snapshot Repository</name>
        <url>s3://projectx-support/maven2</url>
    </snapshotRepository>
</distributionManagement>
运行
mvn--batch mode--settings.circleci/settings.xml依赖项时:脱机
会发生一些奇怪的事情。它会快速下载一些依赖项:

mvn --batch-mode --settings .circleci/settings.xml dependency:go-offline
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/com/allogy/maven/wagon/maven-s3-wagon/1.1.0/maven-s3-wagon-1.1.0.pom
Downloaded: http://repo.maven.apache.org/maven2/com/allogy/maven/wagon/maven-s3-wagon/1.1.0/maven-s3-wagon-1.1.0.pom (7 KB at 47.0 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/com/allogy/allogy-maven-pom-oss/2.0/allogy-maven-pom-oss-2.0.pom
Downloaded: http://repo.maven.apache.org/maven2/com/allogy/allogy-maven-pom-oss/2.0/allogy-maven-pom-oss-2.0.pom (10 KB at 808.4 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/com/google/guava/guava/15.0/guava-15.0.pom
Downloaded: http://repo.maven.apache.org/maven2/com/google/guava/guava/15.0/guava-15.0.pom (7 KB at 508.8 KB/sec)
.
.
.
Downloading: http://repo.maven.apache.org/maven2/org/apache/apache/16/apache-16.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/apache/16/apache-16.pom (16 KB at 1879.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.10/maven-dependency-plugin-2.10.jar (157 KB at 12014.5 KB/sec)
然后它显示:

[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building projectx 1.0.0-beta.2
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-dependency-plugin:2.10:go-offline (default-cli) @ projectx >>>
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:resolve-plugins (resolve-plugins) @ projectx ---
并下载更多DEP:

Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.pom (2 KB at 171.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven/2.2.1/maven-2.2.1.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven/2.2.1/maven-2.2.1.pom (22 KB at 2431.5 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/11/maven-parent-11.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/11/maven-parent-11.pom (32 KB at 3516.6 KB/sec)
.
.
.
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.jar (29 KB at 4118.2 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.2/maven-jar-plugin-2.2.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-jar-plugin/2.2/maven-jar-plugin-2.2.jar (27 KB at 3252.7 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3/maven-install-plugin-2.3.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3/maven-install-plugin-2.3.jar (23 KB at 2775.0 KB/sec)
但随后它尝试从S3存储库下载Maven Central中应该存在的JAR:

[INFO] Plugin Resolved: copy-rename-maven-plugin-1.0.1.jar
Downloading: s3://projectx-support/maven2/com/coderplus/maven/plugins/copy-rename-maven-plugin/1.0.1/copy-rename-maven-plugin-1.0.1.pom
[INFO] File permissions: Private
[INFO] Logged in - projectx-support
[INFO] Downloading: s3://projectx-support/maven2/com/coderplus/maven/plugins/copy-rename-maven-plugin/1.0.1/copy-rename-maven-plugin-1.0.1.pom
[INFO] Logged off - projectx-support
[INFO] Transfers: 1 Time: 27ms Amount: 0 bytes Throughput: 0.000 bytes/s
Downloading: http://repo.maven.apache.org/maven2/com/coderplus/maven/plugins/copy-rename-maven-plugin/1.0.1/copy-rename-maven-plugin-1.0.1.pom
Downloaded: http://repo.maven.apache.org/maven2/com/coderplus/maven/plugins/copy-rename-maven-plugin/1.0.1/copy-rename-maven-plugin-1.0.1.pom (5 KB at 418.0 KB/sec)
Downloading: s3://projectx-support/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
[INFO] File permissions: Private
[INFO] Logged in - projectx-support
[INFO] Downloading: s3://projectx-support/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
[INFO] Logged off - projectx-support
[INFO] Transfers: 1 Time: 11ms Amount: 0 bytes Throughput: 0.000 bytes/s
Downloading: http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9.pom (7 KB at 712.8 KB/sec)
Downloading: s3://projectx-support/maven2/org/apache/maven/maven-model/2.0.9/maven-model-2.0.9.jar
[INFO] File permissions: Private
[INFO] Logged in - projectx-support
[INFO] Downloading: s3://projectx-support/maven2/org/apache/maven/maven-model/2.0.9/maven-model-2.0.9.jar
[INFO] Logged off - projectx-support
[INFO] Transfers: 1 Time: 12ms Amount: 0 bytes Throughput: 0.000 bytes/s
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-model/2.0.9/maven-model-2.0.9.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-model/2.0.9/maven-model-2.0.9.jar (86 KB at 9475.0 KB/sec)
Downloading: s3://projectx-support/maven2/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.jar
[INFO] File permissions: Private
[INFO] Logged in - projectx-support
[INFO] Downloading: s3://projectx-support/maven2/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.jar
[INFO] Logged off - projectx-support
[INFO] Transfers: 1 Time: 12ms Amount: 0 bytes Throughput: 0.000 bytes/s
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.jar
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-project/2.0.9/maven-project-2.0.9.jar (119 KB at 11892.6 KB/sec)
Downloading: s3://projectx-support/maven2/org/apache/maven/maven-core/2.0.9/maven-core-2.0.9.jar
一段时间后,AWS开始抛出
连接被拒绝
错误(可能是某些保护系统?),并且仅存在于S3 repo中的依赖项未被下载:

Downloading: s3://projectx-support/maven2/tech/projectx/projectxcommon/1.0.0-SNAPSHOT/maven-metadata.xml
[WARN] s3://projectx-support/maven2 - Connection refused
[INFO] Logged off - projectx-support
[WARNING] Could not transfer metadata tech.projectx:projectxcommon:1.0.0-SNAPSHOT/maven-metadata.xml from/to projectx-aws (s3://projectx-support/maven2): Could not connect to repository
[WARNING] Failure to transfer tech.projectx:projectxcommon:1.0.0-SNAPSHOT/maven-metadata.xml from s3://projectx-support/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of projectx-aws has elapsed or updates are forced. Original error: Could not transfer metadata tech.projectx:projectxcommon:1.0.0-SNAPSHOT/maven-metadata.xml from/to projectx-aws (s3://projectx-support/maven2): Could not connect to repository
Downloading: s3://projectx-support/maven2/tech/projectx/projectxcommon/1.0.0-SNAPSHOT/projectxcommon-1.0.0-SNAPSHOT.pom
[WARN] s3://projectx-support/maven2 - Connection refused
[INFO] Logged off - projectx-support
这会导致编译失败:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.929s
[INFO] Finished at: Wed Apr 18 16:03:19 UTC 2018
[INFO] Final Memory: 32M/1067M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project projectx: Could not resolve dependencies for project tech.projectx:projectx:jar:1.0.0-beta.2: Failed to collect dependencies for [tech.projectx:projectxcommon:jar:1.0.0-SNAPSHOT (compile), org.projectlombok:lombok:jar:1.16.20 (compile), org.springframework:spring-web:jar:5.0.5.RELEASE (compile), org.springframework.retry:spring-retry:jar:1.2.2.RELEASE (compile), com.fasterxml.jackson.core:jackson-databind:jar:2.9.5 (compile), org.kordamp.ikonli:ikonli-javafx:jar:2.1.1 (compile), org.kordamp.ikonli:ikonli-fontawesome5-pack:jar:2.1.1 (compile), net.harawata:appdirs:jar:1.0.1 (compile), io.sentry:sentry:jar:1.7.3 (compile), org.javassist:javassist:jar:3.22.0-CR2 (compile), junit:junit:jar:4.12 (test)]: Failed to read artifact descriptor for tech.projectx:projectxcommon:jar:1.0.0-SNAPSHOT: Could not transfer artifact tech.projectx:projectxcommon:pom:1.0.0-SNAPSHOT from/to projectx-aws (s3://projectx-support/maven2): Could not connect to repository: Couldn't initialize a SAX driver to create an XMLReader: SAX2 driver class org.apache.xerces.parsers.SAXParser not found -> [Help 1]
知道发生了什么事吗?这似乎是不确定的。它来来去去去的变化不应该对它有任何影响,虽然它似乎是相当一致的,因为重建似乎不会改变结果。我确信这些凭证是有效的,因为它们在两个项目中使用,一个项目正在工作,它们与此项目工作时使用的相同

自从我从Gradle转到Maven后,这种情况一直在发生,但由于这是一个完全不同的系统,我认为这不是一个非常有用的比较

当我在自己的计算机上运行
mvn--batch mode--settings.circleci/settings.xml依赖项:脱机安装-e-X
,删除~/.m2/repository后,输出如下所示:当我在circleci中执行相同操作时,输出如下所示:

在列出当前的存储库时,我看到以下答案:

<repositories>
    <repository>
        <id>projectx-aws</id>
        <url>s3://projectx-support/maven2</url>
        <layout>default</layout>
        <locations class="linked-hash-map">
            <entry>
                <string></string>
                <inputLocation>
                    <lineNumber>461</lineNumber>
                    <columnNumber>21</columnNumber>
                    <source>
                        <modelId>tech.projectx:projectx:1.0.0-beta.2</modelId>
                        <location>C:\Users\pupeno\Documents\projectx\code\projectx\pom.xml</location>
                    </source>
                </inputLocation>
            </entry>
            <entry>
                <string>id</string>
                <inputLocation>
                    <lineNumber>462</lineNumber>
                    <columnNumber>17</columnNumber>
                    <source reference="../../../entry/inputLocation/source"/>
                </inputLocation>
            </entry>
            <entry>
                <string>url</string>
                <inputLocation>
                    <lineNumber>463</lineNumber>
                    <columnNumber>18</columnNumber>
                    <source reference="../../../entry/inputLocation/source"/>
                </inputLocation>
            </entry>
        </locations>
        <releases>
            <enabled>true</enabled>
            <locations class="linked-hash-map">
                <entry>
                    <string></string>
                    <inputLocation>
                        <lineNumber>464</lineNumber>
                        <columnNumber>23</columnNumber>
                        <source reference="../../../../../locations/entry/inputLocation/source"/>
                    </inputLocation>
                </entry>
                <entry>
                    <string>enabled</string>
                    <inputLocation>
                        <lineNumber>465</lineNumber>
                        <columnNumber>26</columnNumber>
                        <source reference="../../../../../locations/entry/inputLocation/source"/>
                    </inputLocation>
                </entry>
            </locations>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <locations class="linked-hash-map">
                <entry>
                    <string></string>
                    <inputLocation>
                        <lineNumber>467</lineNumber>
                        <columnNumber>24</columnNumber>
                        <source reference="../../../../../locations/entry/inputLocation/source"/>
                    </inputLocation>
                </entry>
                <entry>
                    <string>enabled</string>
                    <inputLocation>
                        <lineNumber>468</lineNumber>
                        <columnNumber>26</columnNumber>
                        <source reference="../../../../../locations/entry/inputLocation/source"/>
                    </inputLocation>
                </entry>
            </locations>
        </snapshots>
    </repository>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
我的应用程序的依赖关系树如下所示:

> mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< tech.projectx:projectx >------------------------
[INFO] Building projectx 1.0.0-beta.2
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ projectx ---
[INFO] tech.projectx:projectx:jar:1.0.0-beta.2
[INFO] +- tech.projectx:projectxcommon:jar:1.0.0-SNAPSHOT:compile
[INFO] |  +- org.bouncycastle:bcprov-jdk15on:jar:1.59:compile
[INFO] |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.9.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] |  |  \- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] |  +- org.glassfish:javax.el:jar:3.0.1-b10:compile
[INFO] |  +- org.springframework:spring-context:jar:5.0.5.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:5.0.5.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:5.0.5.RELEASE:compile
[INFO] |  +- com.pubnub:pubnub-gson:jar:4.19.0:compile
[INFO] |  |  +- com.squareup.retrofit2:retrofit:jar:2.3.0:compile
[INFO] |  |  +- com.squareup.okhttp3:okhttp:jar:3.9.1:compile
[INFO] |  |  |  \- com.squareup.okio:okio:jar:1.13.0:compile
[INFO] |  |  +- com.squareup.okhttp3:logging-interceptor:jar:3.9.1:compile
[INFO] |  |  +- com.google.code.gson:gson:jar:2.8.2:compile
[INFO] |  |  \- com.squareup.retrofit2:converter-gson:jar:2.3.0:compile
[INFO] |  +- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.5:compile
[INFO] |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.5:compile
[INFO] |  \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.5:compile
[INFO] +- org.projectlombok:lombok:jar:1.16.20:compile
[INFO] +- org.springframework:spring-web:jar:5.0.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:5.0.5.RELEASE:compile
[INFO] |  \- org.springframework:spring-core:jar:5.0.5.RELEASE:compile
[INFO] |     \- org.springframework:spring-jcl:jar:5.0.5.RELEASE:compile
[INFO] +- org.springframework.retry:spring-retry:jar:1.2.2.RELEASE:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.5:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.5:compile
[INFO] +- org.kordamp.ikonli:ikonli-javafx:jar:2.1.1:compile
[INFO] |  \- org.kordamp.ikonli:ikonli-core:jar:2.1.1:compile
[INFO] +- org.kordamp.ikonli:ikonli-fontawesome5-pack:jar:2.1.1:compile
[INFO] +- net.harawata:appdirs:jar:1.0.1:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] |  \- net.java.dev.jna:jna-platform:jar:4.5.0:compile
[INFO] |     \- net.java.dev.jna:jna:jar:4.5.0:compile
[INFO] +- io.sentry:sentry:jar:1.7.3:compile
[INFO] +- org.javassist:javassist:jar:3.22.0-CR2:compile
[INFO] \- junit:junit:jar:4.12:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.188 s
[INFO] Finished at: 2018-04-23T20:38:39+01:00
[INFO] ------------------------------------------------------------------------
# Java Gradle CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
      - image: circleci/jdk8:0.1.1

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # - image: circleci/postgres:9.4

    working_directory: ~/repo

    environment:
      # Customize the JVM maximum heap limit
      JVM_OPTS: -Xmx3200m
      TERM: dumb

    steps:
       - checkout

       - run: apt-get update

       - run: apt-get install --assume-yes maven

       - restore_cache:
           key: projectx-{{ checksum "pom.xml" }}

       - run: mvn --batch-mode --settings .circleci/settings.xml dependency:go-offline install -e -X

       - save_cache:
           paths:
             - ~/.m2
           key: projectx-{{ checksum "pom.xml" }}

       - run: mvn --batch-mode --settings .circleci/settings.xml test
我已为此bucket启用了日志记录,其中一个条目如下所示(预期为404):

以下是对
maven metadata.xml
的最后3次访问:


    • 问题在于,Maven本身定义的Maven Central在存储库顺序中总是排在最后,因此,projectx的S3 repo受到许多请求的影响,这些请求都失败了,最终AWS S3在下载
      projectxcommon
      jar之前暂时阻塞了客户端

      将Maven Central放在S3存储库之前的唯一方法是在
      pom.xml
      中的
      projectx aws
      repo之前手动定义它:

      <repositories>
          <repository>
              <id>central</id>
              <name>Central Repository</name>
              <url>http://repo.maven.apache.org/maven2</url>
              <layout>default</layout>
              <snapshots>
                  <enabled>false</enabled>
              </snapshots>
          </repository>
          <repository>
              <id>projectX-aws</id>
              <url>s3://projectX-support/maven2</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
          </repository>
      </repositories>
      
      
      中心的
      中央知识库
      http://repo.maven.apache.org/maven2
      违约
      假的
      projectX aws
      s3://projectX支持/maven2
      真的
      真的
      
      有关设置多个存储库及其顺序的更多信息,请访问:


      堆栈溢出中的一些答案提到了字母顺序。至少在Maven 3中,这是不正确的,只有定义它们的顺序才重要。

      主要问题可能是对
      Amazon S3
      存储库的请求太多

      通过分析日志,我们可以在短时间1-3秒内看到120多个从Amazon S3下载文件的请求:

      • Maven正在下载亚马逊S3中不存在的人工制品,然后 从
        Maven Central
        下载,那些对
        amazons3
        的请求是无用的
      • 每次下载都需要一个登录和注销请求,真奇怪
      • 最后40个请求被拒绝连接
      • 最近40个请求没有登录到[INFO]-projectx支持 声明对于他们来说,那么短时间内登录可能有一些限制
      要解决此问题,至少有两种解决方案:

    • 强制maven首先从
      maven Central
      下载人工制品, 然后从
      amazons3
      ,减少对
      amazons3
      的请求。 这是一个很好的解决方案,但请记住,如果您有更多的解决方案 仅从Amazon S3下载的人工制品,您将获得相同的 问题

      默认情况下,
      Maven Central
      位于存储库的最后一个位置,要设置最高优先级并首先从
      Maven Center
      下载,我们必须 手动将其添加到存储库中的第一个位置,因为存储库的顺序也将决定存储库访问的顺序。 ():

      
      中心的
      中央知识库
      https://repo.maven.apache.org/maven2
      违约
      假的
      projectX aws
      s3://projectX支持/maven2
      真的
      真的
      
    • amazons3
      存储库。此解决方案将始终有效,但您的AmazonS3将收到许多无用的请求

    • 因此,解决问题的最佳方法是将这两种解决方案混合使用

      除非您明确地做了一些事情来避免它,
      central
      在默认情况下总是在存储库列表中,即使您添加了新的repo。@AdrianShum是的,在日志中我们可以看到mvn正在从central下载工件。但存储库的顺序也将决定存储库访问的顺序。因此,这可能会避免从s3下载所有内容。@AdrianShum从
      Maven 3.x开始,存储库的顺序确实很重要,这就是为什么显式定义它可以帮助OP。好吧,将HTTP更改为HTTPS就足够了?感谢您提供的信息:)
      
      > mvn dependency:tree
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------< tech.projectx:projectx >------------------------
      [INFO] Building projectx 1.0.0-beta.2
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ projectx ---
      [INFO] tech.projectx:projectx:jar:1.0.0-beta.2
      [INFO] +- tech.projectx:projectxcommon:jar:1.0.0-SNAPSHOT:compile
      [INFO] |  +- org.bouncycastle:bcprov-jdk15on:jar:1.59:compile
      [INFO] |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
      [INFO] |  +- org.hibernate.validator:hibernate-validator:jar:6.0.9.Final:compile
      [INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
      [INFO] |  |  \- com.fasterxml:classmate:jar:1.3.4:compile
      [INFO] |  +- org.glassfish:javax.el:jar:3.0.1-b10:compile
      [INFO] |  +- org.springframework:spring-context:jar:5.0.5.RELEASE:compile
      [INFO] |  |  +- org.springframework:spring-aop:jar:5.0.5.RELEASE:compile
      [INFO] |  |  \- org.springframework:spring-expression:jar:5.0.5.RELEASE:compile
      [INFO] |  +- com.pubnub:pubnub-gson:jar:4.19.0:compile
      [INFO] |  |  +- com.squareup.retrofit2:retrofit:jar:2.3.0:compile
      [INFO] |  |  +- com.squareup.okhttp3:okhttp:jar:3.9.1:compile
      [INFO] |  |  |  \- com.squareup.okio:okio:jar:1.13.0:compile
      [INFO] |  |  +- com.squareup.okhttp3:logging-interceptor:jar:3.9.1:compile
      [INFO] |  |  +- com.google.code.gson:gson:jar:2.8.2:compile
      [INFO] |  |  \- com.squareup.retrofit2:converter-gson:jar:2.3.0:compile
      [INFO] |  +- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.5:compile
      [INFO] |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.5:compile
      [INFO] |  \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.5:compile
      [INFO] +- org.projectlombok:lombok:jar:1.16.20:compile
      [INFO] +- org.springframework:spring-web:jar:5.0.5.RELEASE:compile
      [INFO] |  +- org.springframework:spring-beans:jar:5.0.5.RELEASE:compile
      [INFO] |  \- org.springframework:spring-core:jar:5.0.5.RELEASE:compile
      [INFO] |     \- org.springframework:spring-jcl:jar:5.0.5.RELEASE:compile
      [INFO] +- org.springframework.retry:spring-retry:jar:1.2.2.RELEASE:compile
      [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.5:compile
      [INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
      [INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.9.5:compile
      [INFO] +- org.kordamp.ikonli:ikonli-javafx:jar:2.1.1:compile
      [INFO] |  \- org.kordamp.ikonli:ikonli-core:jar:2.1.1:compile
      [INFO] +- org.kordamp.ikonli:ikonli-fontawesome5-pack:jar:2.1.1:compile
      [INFO] +- net.harawata:appdirs:jar:1.0.1:compile
      [INFO] |  +- org.slf4j:slf4j-api:jar:1.7.25:compile
      [INFO] |  \- net.java.dev.jna:jna-platform:jar:4.5.0:compile
      [INFO] |     \- net.java.dev.jna:jna:jar:4.5.0:compile
      [INFO] +- io.sentry:sentry:jar:1.7.3:compile
      [INFO] +- org.javassist:javassist:jar:3.22.0-CR2:compile
      [INFO] \- junit:junit:jar:4.12:test
      [INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1.188 s
      [INFO] Finished at: 2018-04-23T20:38:39+01:00
      [INFO] ------------------------------------------------------------------------
      
      # Java Gradle CircleCI 2.0 configuration file
      #
      # Check https://circleci.com/docs/2.0/language-java/ for more details
      #
      version: 2
      jobs:
        build:
          docker:
            # specify the version you desire here
            - image: circleci/jdk8:0.1.1
      
            # Specify service dependencies here if necessary
            # CircleCI maintains a library of pre-built images
            # documented at https://circleci.com/docs/2.0/circleci-images/
            # - image: circleci/postgres:9.4
      
          working_directory: ~/repo
      
          environment:
            # Customize the JVM maximum heap limit
            JVM_OPTS: -Xmx3200m
            TERM: dumb
      
          steps:
             - checkout
      
             - run: apt-get update
      
             - run: apt-get install --assume-yes maven
      
             - restore_cache:
                 key: projectx-{{ checksum "pom.xml" }}
      
             - run: mvn --batch-mode --settings .circleci/settings.xml dependency:go-offline install -e -X
      
             - save_cache:
                 paths:
                   - ~/.m2
                 key: projectx-{{ checksum "pom.xml" }}
      
             - run: mvn --batch-mode --settings .circleci/settings.xml test
      
      <repositories>
          <repository>
              <id>central</id>
              <name>Central Repository</name>
              <url>http://repo.maven.apache.org/maven2</url>
              <layout>default</layout>
              <snapshots>
                  <enabled>false</enabled>
              </snapshots>
          </repository>
          <repository>
              <id>projectX-aws</id>
              <url>s3://projectX-support/maven2</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
          </repository>
      </repositories>
      
      <repositories>
          <repository>
              <id>central</id>
              <name>Central Repository</name>
              <url>https://repo.maven.apache.org/maven2</url>
              <layout>default</layout>
              <snapshots>
                  <enabled>false</enabled>
              </snapshots>
          </repository>
          <repository>
              <id>projectX-aws</id>
              <url>s3://projectX-support/maven2</url>
              <releases><enabled>true</enabled></releases>
              <snapshots><enabled>true</enabled></snapshots>
          </repository>
      </repositories>