问题描述
我有一个基于 java 1.6 和
现在我将java版本升级到1.8并构建项目
Now i upgraded the java verion to 1.8 and build the project
这里我使用 gradle 来构建项目这是gradle代码
Here i have used gradle for building the projectHere is the gradle code
task wsgen(dependsOn: compileJava) {
doLast{
ant {
taskdef(name:'wsgen',
classname:'com.sun.tools.ws.ant.WsGen',
classpath:configurations.jaxws.asPath)
wsgen(keep:true,
destdir: "${buildDir}",
resourcedestdir:"${sourceSets.main.output.resourcesDir}",
sourcedestdir:'src/main/java',
genwsdl:'true',
classpath:"${configurations.compile.asPath}:${sourceSets.main.output.classesDir}",
sei:'<sei implementation class>')
}
}
}
和错误,我得到的是
java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory
谁能告诉我,问题出在哪里,从哪里提出来的?
Can any one tell me, where the issue is located and raising from?
谢谢!!!
推荐答案
感谢 @McDowell 提供带有链接的有用评论.所以APT工具不见了.使用版本 7 JDK 来构建您的项目.只需将它与 Java 8 JDK 一起安装并创建一个专门用于构建需要 APT 工具的项目的脚本.
Thanks go out to @McDowell for the useful comment with links. So the APT tool is gone. Use a version 7 JDK for building your project. Just install it alongside your java 8 JDK and create a script specifically for building your project that requires the APT tool.
我遇到了同样的问题,通过使用 1.7 版本的 JDK 运行 maven 解决了这个问题.所以我创建了一个脚本(Windows 平台上的 .cmd),对我来说,它看起来像这样:
I had the same problem and went around it by running maven using the 1.7 version of JDK. So I created a script (.cmd on windows platform) that, for me, looks like this:
set JAVA_HOME="c:\Java\ibm-jdk-1.7.0"
set PATH=%JAVA_HOME%\bin;%PATH%
mvn clean install eclipse:eclipse
这将使用 IBM 版本的 java 7 jdk 成功构建,我碰巧在我的 java 文件夹中.我讨厌我无法使用 1.8 版 jdk 构建我的项目,但至少我可以在其他项目上使用 java 8 功能.
This will successfully build using an IBM version of the java 7 jdk, which i happen to have in my java folder. I hate the fact that I can't build my projects with the version 1.8 jdk but at least i can use java 8 features on other projects.
这篇关于在 Java 8 中找不到 AnnotationProcessorFactory 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!