gpt4 book ai didi

maven-3 - 无法从神器中找到神器

转载 作者:行者123 更新时间:2023-12-01 05:00:18 24 4
gpt4 key购买 nike

我在 Maven 3.2.1 中使用 JFrog artifactory 3.2.1.1。

我上传了一个已构建的项目,该项目存在于存储库浏览器下的 libs-snapshot-local 中。如果我浏览到 com.foo.project,我将在 artifactory 浏览器中看到 project-1.0-20151113.133436-1.jar 文件和 pom 和元数据。

连访问http://example.com:8081/artifactory/webapp/browserepo.html?42&pathId=libs-snapshot-local:com/foo/project/1.0-SNAPSHOT/project-1.0-20151113.133436-1.jar向我展示了里面的 jar 文件。

我使用了 artifactory 中的 settings.xml 生成器来生成 <repository>我在以下 pom.xml 中使用的标记:

<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.foo.bar</groupId>
<artifactId>exampleApp</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>exampleApp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://example.foo:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.foo</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
<type>jar</type>
<includes>myFolder</includes>
<outputDirectory>${project.build.directory}/newFolder/js/gmoketest</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

我只是得到:

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack) on project exampleApp: Unable to find artifact. Failure to find com.foo:project:jar:1.0 in http://example.com:8081/artifactory/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of snapshots has elapsed or updates are forced



如果我改变
http://example.foo:8081/artifactory/libs-snapshot


http://example.foo:8081/artifactory/libs-snapshot-local
然后我得到:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack) on project exampleApp: Unable to resolve artifact. Could not transfer artifact com.foo:project:jar:1.0 from/to snapshots (http://example.com:8081/artifactory/libs-snapshot-local): Failed to transfer file: http://example.com:8081/artifactory/libs-snapshot-local/com/foo/project/1.0/project-1.0.jar. Return code is: 409 , ReasonPhrase:Conflict.



我会不时地将新快照部署到同一个 project-1.0,并希望这个 pom 文件在从 Artifactory 构建时只包含最新的 SNAPSHOT 构建。

最佳答案

答案是,我很快发现需要将版本指定为:

<version>1.0-SNAPSHOT</version>

关于maven-3 - 无法从神器中找到神器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33694808/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com