Mojo的AspectJ Maven插件可以与jdk 9+一起使用吗? [英] Does Mojo's AspectJ Maven Plugin work with jdk 9+?

查看:257
本文介绍了Mojo的AspectJ Maven插件可以与jdk 9+一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Mojo的AspectJ Maven插件的项目.它在jdk 8上正常工作.当我尝试切换到jdk14时,构建失败并出现以下错误:

I have a project that uses Mojo's AspectJ Maven Plugin. It works fine with jdk 8. When I try to switch to jdk14, the build fails with the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile (default) on project AspectJDemo: Execution default of goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile failed: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.11 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:13.0.2 at specified path /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home/../lib/tools.jar -> [Help 1]

Mojo的网站确认此文件是必需的依赖项.但是,根据 tools.jar,自jdk 9起已被删除.我尝试提供在我的依赖项中,此jar文件的硬编码路径如下:

Mojo's website confirms that this file is a required dependency. However, according to this tools.jar has been removed since jdk 9. I have tried to provide a hardcoded path to this jar file in my dependencies like this:

        <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.8</version>
            <scope>system</scope>
            <systemPath>/path/to/tools.jar</systemPath>
        </dependency>

但是,构建完全失败,就好像它完全停止了对Java的识别一样.我收到许多错误,例如:

But then the build completely fails as if it stops recognizing Java entirely. I get numerous errors such as:

[ERROR] can't find critical required type java.lang.Object
        <unknown source file>:<no line information>

这是否意味着Mojo的AspectJ Maven插件不支持jdk9 +?关于如何解决此问题的任何想法都将受到赞赏.

Does this mean Mojo's AspectJ Maven Plugin does not support jdk9+? Any idea on how I could resolve this is appreciated.

推荐答案

该插件自Java 8以来未得到维护,但是存在"rel =" nofollow noreferrer>拉取请求被上游接受.因为Mojohaus没有该插件的活动维护者,并且尚未授予fork的开发人员接管并推出上游发行版的访问权,所以现在仅使用此fork:

The plugin has not been maintained since Java 8, but there is a fork with a pull request to be accepted up-stream. Because Mojohaus has no active maintainer for the plugin and the fork's developer has not been granted access rights to take over and push out an upstream release yet, for now just use this fork:

<dependency>
    <groupId>com.nickwongdev</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.12.6</version>
</dependency>

我已经使用了很长时间,它可靠并且至少可以在Java 13上运行.即使是最新版本的IntelliJ IDEA,也自动将其识别为Mojohaus版本的替代品,因为该过程已经花费了很长时间.

I have used it for a long time, it is reliable and works at least up to Java 13. Even the latest version of IntelliJ IDEA automatically recognises it as an alternative to the Mojohaus version because this process has taken so long already.

P.S .:无需提供硬编码路径,只需使用备用插件即可. :-)

P.S.: There is not need to provide hard-coded paths, just use the alternative plugin. :-)

这篇关于Mojo的AspectJ Maven插件可以与jdk 9+一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆