maven尝试从libs-snapshot存储库下载

时间:2020-10-21 09:37:52

标签: maven jenkins dependency-management

我有一个聚合器POM文件和两个Maven项目:

  1. sample-project-runner-parent-这是父产品

    a)sample-project-runner-model-第一个子模块

    b)sample-project-runner-第二个子模块

我正在使用mvn clean package deploy,并且看到三个工件被上传到工件(http://vdi-setup-repo.com/artifactory/codemanagement-maven

要部署到服务器,我还有一个maven项目,该项目使用Maven依赖插件从工件(在我的情况下为jFrog)中提取/复制JAR,并使用下载的文件进行进一步部署。

出于某些原因,maven尝试从https://vdi-setup-repo.com/artifactory/libs-snapshot而不是http://vdi-setup-repo.com/artifactory/codemanagement-maven来下载JAR

控制台日志:

Downloaded: http://vdi-setup-repo.com/artifactory/codemanagement-maven/com/sample/codes/sample-project/sample-project-runner/1.0.6-SNAPSHOT/sample-project-runner-1.0.6-20201020.172731-2.pom (5 KB at 69.5 KB/sec)
Downloading: https://vdi-setup-repo.com/artifactory/libs-snapshot/com/sample/codes/sample-project/sample-project-runner-parent/1.0.6-SNAPSHOT/sample-project-runner-parent-1.0.6-20201020.172713-2.pom
         
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.659 s
[INFO] Finished at: 2020-10-20T17:27:38+00:00
[INFO] Final Memory: 28M/892M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:copy (copy) on project deploy-sample-project-runner: Unable to find/resolve artifact. Failed to read artifact descriptor for com.sample.codes.sample-project:sample-project-runner:jar:1.0.6-SNAPSHOT: Could not find artifact com.sample.codes.sample-project:sample-project-runner-parent:pom:1.0.6-20201020.172713-2 in snapshots (https://vdi-setup-repo.com/artifactory/libs-snapshot) -> [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/MojoExecutionException

我确实在所有POM文件中指定了存储库,如下所示:

<repositories>
        <repository>
            <id>codemanagement-maven</id>
            <url>http://vdi-setup-repo.com/artifactory/codemanagement-maven</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>codemanagement-maven</id>
            <name>codemanagement-maven</name>
            <url>http://vdi-setup-repo.com/artifactory/codemanagement-maven</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

Deployer POM文件中的复制插件:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                  <execution>
                    <id>copy</id>
                    <phase>package</phase>
                    <goals>
                      <goal>copy</goal>
                    </goals>
                    <configuration>
                      <artifactItems>
                        <artifactItem>
                          <groupId>com.sample.codes.sample-project</groupId>
                          <artifactId>sample-project-runner</artifactId>                          
                          <version>${currentProjectVersion}</version>
                          <type>jar</type>                        
                          <overWrite>true</overWrite>
                          <outputDirectory>.</outputDirectory>
                          <destFileName>${customFilename}</destFileName>
                        </artifactItem>
                      </artifactItems>
                      <!-- other configurations here -->
                    </configuration>
                  </execution>
                </executions>
              </plugin>

即使指定了存储库,我也无法弄清为什么maven试图从libs-snapshot下载工件。 早些时候,这个问题是间歇性发生的,但最近由于每次执行此错误而导致失败。

我是否缺少任何其他配置?

感谢您的帮助。

0 个答案:

没有答案