Java 9迁移javax.annotation [英] Java 9 migration javax.annotation

查看:119
本文介绍了Java 9迁移javax.annotation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我尝试将项目迁移到Java 9,但是该过程似乎并不像我想象的那么容易.我不断收到有关隐形软件包的错误,这些错误可以通过pom中的以下参数修复:

So i try to migrate my project to Java 9 but the process seems not so easy as i thought it would be. I kept getting some errors about invisible packages that i could fix with the following argument in my pom:

<compilerArgs>
     <arg>--add-modules</arg>
     <arg>java.se.ee</arg>
</compilerArgs>

但是我仍然收到以下错误:

But i still get the following error:

cannot find symbol
[ERROR]   symbol:   class Priority
[ERROR]   location: package javax.annotation

任何帮助将不胜感激

推荐答案

我不确定javax.annotation.Priority的来源,但是不确定

I'm not sure where javax.annotation.Priority comes from, but a solution analog to getting JSR 305 running on Java 9 should fix your problem: Instead of adding the (deprecated) Java EE module java.xml.ws.annotation (which you do indirectly by adding java.se.ee), you should instead add the javax.annotation package from an external artifact, namely javax.annotation:javax.annotation-api.

如果您将代码模块化,则该解决方案将不再起作用,您必须开始修补模块.或者,甚至更好的是,摆脱需要非JDK类的解决方案,这些类伪装成来自javajavax软件包,因为这总是会引起问题.

If you modularize your code, that solution no longer works and you have to start patching modules. Or, even better, move away from solutions that require non-JDK classes that pretend to come from java or javax packages because that will always cause problems.

这篇关于Java 9迁移javax.annotation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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