gpt4 book ai didi

ant - Maven Antrun : failed to create task or type replaceregexp

转载 作者:行者123 更新时间:2023-12-01 22:21:37 25 4
gpt4 key购买 nike

我正在尝试使用 Maven 编写一个简单的任务:

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<replaceregexp file="dir=target/liquibase/*.sql" match="**DATABASECHANGELOGLOCK**"
replace="" byline="true" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>

当我运行这个时,我得到

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (default) on project Tik
[ERROR] Cause: the class org.apache.tools.ant.taskdefs.optional.ReplaceRegExp was not found.
[ERROR] This looks like one of Ant's optional components.
[ERROR] Action: Check that the appropriate optional JAR exists in
[ERROR] -ANT_HOME\lib
[ERROR] -the IDE Ant configuration dialogs
[ERROR]
[ERROR] Do not panic, this is a common problem.
[ERROR] The commonest cause is a missing JAR.
[ERROR]
[ERROR] This is not a bug; it is a configuration problem
[ERROR] -> [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/MojoExecutionException

我已经包含了 antant-nodeps 依赖项,但无法使其运行,并且谷歌搜索也没有任何帮助。

有没有人能解决这个问题?

最佳答案

我写这篇文章是为了防止有人遇到这个问题

问题是maven不关心ANT_HOME或任何东西。依赖项必须在 antrun 插件内声明。

所以我将我的 pom.xml 更改为如下所示:

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
</dependencies>
<executions><execution>...</execution></executions>
</plugin>

关于ant - Maven Antrun : failed to create task or type replaceregexp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6445241/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com