[英]A build failure occurs when a maven project is running
我正在使用 Maven 3.8.2,並且正在嘗試使用 mvn clean install 命令運行該項目。 但是我收到以下錯誤消息的構建失敗。
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.552 s
[INFO] Finished at: 2022-07-18T12:01:36+05:30
[INFO] Final Memory: 92M/317M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java-version) on project abcTest: Unable to parse configuration of mojo org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce for parameter bannedRepositories: Cannot assign configuration entry 'bannedRepositories' with value 'http://*' of type java.lang.String to property of type java.util.List -> [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/PluginConfigurationException
你能幫我解決上述問題嗎?
首先是使用舊版本的 maven-enforcer-plugin。 這意味着您應該升級到最新版本。
錯誤消息告訴您您的配置錯誤。
配置應如下所示:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-banned-repositories</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedRepositories>
<bannedRepositories>
<bannedRepository>http://repo1/*<bannedRepository>
</bannedRepositories>
<bannedPluginRepositories>
<bannedPluginRepository>http://repo1/*<bannedPluginRepository>
</bannedPluginRepositories>
<!-- for some cases, white list is more effective -->
<!--
<allowedRepositories>
<allowedRepository>http://repo2/*<allowedRepository>
</allowedRepositories>
<allowedPluginRepositories>
<allowedPluginRepository>http://repo2/*<allowedPluginRepository>
</allowedPluginRepositories>
-->
</bannedRepositories>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
完整的文檔可以在這里找到: https ://maven.apache.org/enforcer/enforcer-rules/bannedRepositories.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.