我希望每次在清理安装期间在maven src/main中创建两个新目录。
最初,我使用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干净安装上面的代码中,它会导致生成失败,并出现以下错误,
[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
发布于 2018-04-12 10:54:12
这将根本无法工作,因为版本1.9的maven-antrun-plugin不存在maven.apache.org/plugins。
除此之外,在src构建过程中创建目录是个坏主意.
https://stackoverflow.com/questions/49791003
复制相似问题