从 jfrog artifactory 获取 maven 插件时出现问题
Problem getting maven plugin from jfrog artifactory
我正在尝试将一个旧的 Maven 项目连接到私有 artifactory,以便在构建时下载插件。我坐在公司网络中(使用 vpn),使用 jfrog artifactory。
"mvn clean install -U"returns:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProjektYXZ - parent POM [pom]
[INFO] ProjektYXZ - main POM [pom]
[INFO]
[INFO] ---------------------< com.*:mvn-project >----------------------
[INFO] Building ProjektYXZ - parent POM 1.14.0-SNAPSHOT [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mvn-project ---
[INFO] Deleting **mvn-project\target
[INFO]
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources @ mvn-project >>>
[INFO]
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) < generate-sources @ mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @ mvn-project ---
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) @ mvn-project ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-checkstyle-plugin:3.0.0:check (default) @ mvn-project ---
[INFO]
[INFO] >>> spotbugs-maven-plugin:3.1.11:check (default) > :spotbugs @ mvn-project >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:spotbugs (spotbugs) @ mvn-project ---
[INFO]
[INFO] <<< spotbugs-maven-plugin:3.1.11:check (default) < :spotbugs @ mvn-project <<<
[INFO]
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:check (default) @ mvn-project ---
[INFO]
[INFO] >>> maven-pmd-plugin:3.11.0:check (default) > :pmd @ mvn-project >>>
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:pmd (pmd) @ mvn-project ---
[INFO]
[INFO] <<< maven-pmd-plugin:3.11.0:check (default) < :pmd @ mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:check (default) @ mvn-project ---
[INFO]
[INFO] --- plugin:1.4.1:enforce (default) @ mvn-project ---
Downloading from central-mirror: https://artifactory.*.de/artifactory/maven/**/*-1.0.2.pom
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
[WARNING] The POM for com.**:jar:1.0.2 is missing, no dependency information available
Downloading from central-mirror: https://artifactory.**.de/artifactory/maven/**/*-1.0.2.jar
Downloading from company-releases: https://artifactory.**.de/artifactory/**/*-1.0.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ProjektYXZ - main POM 1.14.0-SNAPSHOT:
[INFO]
[INFO] ProjektYXZ - parent POM .................................. FAILURE [ 7.645 s]
[INFO] ProjektYXZ - main POM .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.826 s
[INFO] Finished at: 2022-04-12T10:18:02+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:plugin:1.4.1:enforce (default) on project mvn-project: Execution default of goal org.apache.maven.plugins:plugin:1.4.1:enforce failed: Plugin org.apache.maven.plugins:plugin:1.4.1 or one of its dependencies could not be resolved: Could not find artifact com.**:jar:1.0.2 in central-mirror (https://artifactory.**.de/artifactory/maven) -> [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/PluginResolutionException
行中:
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
maven 看对了地方。我可以用 curl 下载它:
curl -u username:password -X GET "https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom"
但是如果我将该路径粘贴到 Chrome,我会收到 404 错误。
我还在我的 C:/Users/Username/.m2/ 文件夹中配置了 settings.xml:
<server>
<id>company-releases</id>
<username>my_username</username>
<password>my_password</password>
</server>
我还检查了日志底部显示的 Link 的可能错误,但由于我能够“卷曲”它,所以这些似乎不是原因。目前我没有想法。希望您能帮助我 :) 如果您需要查看其他资源,请告诉我。
好的,解决方案是在 settings.xml 中设置抢占式身份验证:
例如:
<server>
<username>*****</username>
<password>*****</password>
<id>central</id>
<configuration>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
说明:maven首先尝试不经认证的请求。如果 Repo 是私有的(这意味着没有身份验证,工件是隐藏的),jfrog artifactory 响应 404 而不是未验证。 404之后maven不再重试,但认为失败了。
我正在尝试将一个旧的 Maven 项目连接到私有 artifactory,以便在构建时下载插件。我坐在公司网络中(使用 vpn),使用 jfrog artifactory。
"mvn clean install -U"returns:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProjektYXZ - parent POM [pom]
[INFO] ProjektYXZ - main POM [pom]
[INFO]
[INFO] ---------------------< com.*:mvn-project >----------------------
[INFO] Building ProjektYXZ - parent POM 1.14.0-SNAPSHOT [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ mvn-project ---
[INFO] Deleting **mvn-project\target
[INFO]
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources @ mvn-project >>>
[INFO]
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) < generate-sources @ mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @ mvn-project ---
[INFO]
[INFO] --- maven-javadoc-plugin:3.0.1:jar (attach-javadocs) @ mvn-project ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-checkstyle-plugin:3.0.0:check (default) @ mvn-project ---
[INFO]
[INFO] >>> spotbugs-maven-plugin:3.1.11:check (default) > :spotbugs @ mvn-project >>>
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:spotbugs (spotbugs) @ mvn-project ---
[INFO]
[INFO] <<< spotbugs-maven-plugin:3.1.11:check (default) < :spotbugs @ mvn-project <<<
[INFO]
[INFO]
[INFO] --- spotbugs-maven-plugin:3.1.11:check (default) @ mvn-project ---
[INFO]
[INFO] >>> maven-pmd-plugin:3.11.0:check (default) > :pmd @ mvn-project >>>
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:pmd (pmd) @ mvn-project ---
[INFO]
[INFO] <<< maven-pmd-plugin:3.11.0:check (default) < :pmd @ mvn-project <<<
[INFO]
[INFO]
[INFO] --- maven-pmd-plugin:3.11.0:check (default) @ mvn-project ---
[INFO]
[INFO] --- plugin:1.4.1:enforce (default) @ mvn-project ---
Downloading from central-mirror: https://artifactory.*.de/artifactory/maven/**/*-1.0.2.pom
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
[WARNING] The POM for com.**:jar:1.0.2 is missing, no dependency information available
Downloading from central-mirror: https://artifactory.**.de/artifactory/maven/**/*-1.0.2.jar
Downloading from company-releases: https://artifactory.**.de/artifactory/**/*-1.0.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for ProjektYXZ - main POM 1.14.0-SNAPSHOT:
[INFO]
[INFO] ProjektYXZ - parent POM .................................. FAILURE [ 7.645 s]
[INFO] ProjektYXZ - main POM .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.826 s
[INFO] Finished at: 2022-04-12T10:18:02+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:plugin:1.4.1:enforce (default) on project mvn-project: Execution default of goal org.apache.maven.plugins:plugin:1.4.1:enforce failed: Plugin org.apache.maven.plugins:plugin:1.4.1 or one of its dependencies could not be resolved: Could not find artifact com.**:jar:1.0.2 in central-mirror (https://artifactory.**.de/artifactory/maven) -> [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/PluginResolutionException
行中:
Downloading from company-releases: https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom
maven 看对了地方。我可以用 curl 下载它:
curl -u username:password -X GET "https://artifactory.**.de/artifactory/**/1.0.2/*-1.0.2.pom"
但是如果我将该路径粘贴到 Chrome,我会收到 404 错误。
我还在我的 C:/Users/Username/.m2/ 文件夹中配置了 settings.xml:
<server>
<id>company-releases</id>
<username>my_username</username>
<password>my_password</password>
</server>
我还检查了日志底部显示的 Link 的可能错误,但由于我能够“卷曲”它,所以这些似乎不是原因。目前我没有想法。希望您能帮助我 :) 如果您需要查看其他资源,请告诉我。
好的,解决方案是在 settings.xml 中设置抢占式身份验证:
例如:
<server>
<username>*****</username>
<password>*****</password>
<id>central</id>
<configuration>
<httpConfiguration>
<all>
<usePreemptive>true</usePreemptive>
</all>
</httpConfiguration>
</configuration>
</server>
说明:maven首先尝试不经认证的请求。如果 Repo 是私有的(这意味着没有身份验证,工件是隐藏的),jfrog artifactory 响应 404 而不是未验证。 404之后maven不再重试,但认为失败了。