gpt4 book ai didi

java - 从 maven-antrun-plugin 调用 ant 脚本时出现 IllegalAccessError

转载 作者:搜寻专家 更新时间:2023-11-01 03:14:52 24 4
gpt4 key购买 nike

我刚刚将 Maven 从 2.0.9 更新到 2.2.1,在运行 Maven 构建时出现以下异常:

INFO] [antrun:run {execution: precompile-jsp}][INFO] Executing tasksdefault:jspc:    [mkdir] Created dir: C:\builds\trunk\webapps\vyre_portlets\WEB-INF\jsp_src[INFO] ------------------------------------------------------------------------[ERROR] BUILD ERROR[INFO] ------------------------------------------------------------------------[INFO] An Ant BuildException has occured: The following error occurred while executing this line:C:\unify\trunk\portlets\build-jsps.xml:87: The following error occurred while executing this line:C:\unify\trunk\portlets\build-jsps.xml:7: java.lang.IllegalAccessError: tried to access method org.apache.tools.ant.launch.Locator.decodeUri(Ljava/lang/String;)Ljava/lang/String; from class org.apache.tools.ant.AntClassLoader

build-jsps.xml ant 脚本运行 org.apache.jasper.JspC 任务以在 maven 正在构建的 webapp 中预编译 JSP。这在 Maven 2.0.9 中运行良好。

谷歌给了一堆人问类似的问题,但没有答案。有没有人遇到过这个并且知道如何解决这个问题?或者甚至只是我收到 IllegalAccessError 的原因?

最佳答案

尝试明确地为“maven-antrun-plugin”设置 ANT 依赖。

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
....
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.7.0</version>
</dependency>
</dependencies>
</plugin>

请注意,您可以在 Maven 的公共(public)存储库中的多个位置找到 ANT:

  1. <groupId>org.apache.ant</groupId>
  2. <groupId>ant</groupId>

(2) 是旧的,所以用 (1) 代替

关于java - 从 maven-antrun-plugin 调用 ant 脚本时出现 IllegalAccessError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1321711/

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