gpt4 book ai didi

java - 将 Axis 1.4 stub 项目移动到基于 Maven 的项目(类型访问限制)

转载 作者:行者123 更新时间:2023-12-01 05:54:58 26 4
gpt4 key购买 nike

出于兼容性原因,我必须通过退出 wsdl 文件来构建 Axis 1.4 骨架类。我使用 Axis 14 附带的 wsdl2java ant-task。

我在 Java SDK 1.6.0_18 上使用 MyEclipse 8.5,我将所需的库添加到我的构建路径中,一切正常。

现在,我将普通项目移至 Apache Maven2 项目,因为我添加了依赖项,所以收到以下警告 (~500):

Description Resource Path Location Type Access restriction: The constructor QName(String, String) is not accessible due to restriction on required library /usr/local/uvst/standard/jdk1.6.0_18/jre/lib/rt.jar

我已经在这里读过类似的问题,但我不同意 Access restriction on class due to restriction on required library rt.jar? 的答案.

因为在普通的Java项目中没有

Access restriction on class due to restriction

出现警告。

我的普通 Java 项目中的类路径设置包含最新发行版 Axis 1.4 附带的所有库(我知道它相当旧)。

我的 pom.xml 的依赖部分:

<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>

QName 类位于 axis-jaxrpc.jar 中!

是否有可能让事情顺利进行,而无需从库中删除类文件或禁用 IDE 中的警告设置?

最佳答案

这种情况仅在 Eclipse 下发生吗?如果是,您可以按照 m2eclipse FAQ 中的说明修改编译器设置:

Compilation errors on restricted classes

Projects using classes from rt.jar, such as com.sun.* (and some others) can have compilation errors like: "Access restriction: The type RE is not accessible due to restriction on required library /lib/rt.jar". Such errors indicate use of non-API classes and those access rules are defined by Eclipse JDT.

You can change compiler settings to not fail on those restrictions in workspace settings in Window / Preferences / Java / Compiler / Errors/Warnings / Deprecated and restricted API / Forbidden reference (access rules) / Warnings; or per-project from Project / Properties / Java Compiler / Errors/Warnings / Deprecated and restricted API / Forbidden reference (access rules) / Warnings

关于java - 将 Axis 1.4 stub 项目移动到基于 Maven 的项目(类型访问限制),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3318618/

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