无法解析插件 maven-antrun-plugin 或其依赖项之一
Plugin maven-antrun-plugin or one of its dependencies could not be resolved
我想在 Maven 全新安装期间每次在 src/main 中创建 2 个新目录。
最初我使用 maven-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 | Ant 版本 - 1.9.4
这根本行不通,因为 1.9 版的 maven-antrun-plugin 不存在 maven.apache.org/plugins
除了在 src
构建期间创建目录是个坏主意...
我想在 Maven 全新安装期间每次在 src/main 中创建 2 个新目录。
最初我使用 maven-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 | Ant 版本 - 1.9.4
这根本行不通,因为 1.9 版的 maven-antrun-plugin 不存在 maven.apache.org/plugins
除了在 src
构建期间创建目录是个坏主意...