【问题标题】:Plugin maven-antrun-plugin or one of its dependencies could not be resolved插件 maven-antrun-plugin 或其依赖项之一无法解析
【发布时间】:2018-04-12 07:58:14
【问题描述】:

我想每次在 maven 全新安装期间在 src/main 中创建 2 个新目录。

最初我是使用 ma​​ven-antrun-plugin 来做的,但是新版本的 maven 已经停止支持这个插件了。

下面是我在 pom.xml 中的代码

<plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-antrun-plugin</artifactId>
              <version>1.7</version>
              <executions>
                  <execution>
                      <id>staticFolder</id>
                      <phase>generate-test-resources</phase>
                      <configuration>
                          <tasks>
                            <delete dir="./src/main/resources/static"/>
                            <mkdir dir="./src/main/resources/static"/>
                          </tasks>
                      </configuration>
                      <goals>
                          <goal>run</goal>
                      </goals>
                  </execution>
                  <execution>
                      <id>templatesFolder</id>
                      <phase>generate-test-resources</phase>
                      <configuration>
                          <tasks>
                             <delete dir="./src/main/resources/templates"/>
                             <mkdir dir="./src/main/resources/templates"/>
                          </tasks>
                      </configuration>
                      <goals>
                          <goal>run</goal>
                      </goals>
                  </execution>
              </executions>
            </plugin>

在上面代码的 maven clean install 上,它会导致构建失败并出现以下错误,

[WARNING] The POM for org.apache.maven.plugins:maven-antrun-plugin:jar:1.9 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.9/maven-antrun-plugin-1.9.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.900 s
[INFO] Finished at: 2018-04-12T13:16:26+05:30
[INFO] Final Memory: 13M/124M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-antrun-plugin:1.9 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-antrun-plugin:jar:1.9 in central (https://repo.maven.apache.org/maven2) -> [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

不确定是否有任何 maven 插件可用于在构建 maven 时创建新目录。如果有,请提出建议。

Maven 版本 - 3.5.2 |蚂蚁版本 - 1.9.4

【问题讨论】:

  • 你在 setting.xml 中有正确的存储库条目吗?
  • 在 setting.xml 中需要什么样的条目?
  • 这根本行不通,因为 1.9 版的 maven-antrun-plugin 不存在...maven.apache.org/plugins 除了在src 的构建过程中创建目录是一个坏主意.. .
  • 除了使用 maven-antrun-plugin 之外,还有其他方法可以从 pom.xml 创建目录结构吗?提前致谢。
  • @khmarbaise 我将 maven-antrun-plugin 版本从 1.7 更改为 1.8,它工作正常。这个链接在这里帮助了我maven.apache.org/plugins。您能否将您的答案粘贴在下方,以便我将其标记为该问题的正确答案。

标签: maven maven-3 pom.xml maven-plugin parent-pom


【解决方案1】:

这根本行不通,因为 1.9 版的 maven-antrun-plugin 不存在 maven.apache.org/plugins

除了在src 的构建过程中创建目录是个坏主意...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-12
    • 2021-06-27
    • 2015-02-15
    • 2017-09-15
    • 2016-10-05
    • 2018-12-29
    • 1970-01-01
    相关资源
    最近更新 更多