I am using JDK8 (tried it on my Eclipse workspace with Win x64 u25 JDK + on Linux launched by Jenkins - jdk-8u20-linux-x64, same problem for both).
我使用的是JDK8(在我的Eclipse工作空间中,使用了由Jenkins开发的Linux上的Win x64 u25 JDK +,这两种方法都是同样的问题)。
I have multi-module Maven project (I am launching Maven goal "javadoc:aggregate" from a main module with packaging type "pom").
我有一个多模块Maven项目(我正在启动Maven目标“javadoc:聚合”,从一个带有打包类型“pom”的主模块)。
Pom build section looks like this:
Pom构建部分如下:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
I always receive error:
我总是收到错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.1:aggregate (default-cli) on project uloan-global-build: An error has occurred in JavaDocs report generation:
[ERROR] Exit code: 1 - javadoc: error - com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: com.sun.tools.doclets.internal.toolkit.util.DocletAbortException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for javax.interceptor.InterceptorBinding not found
[ERROR]
[ERROR] Command line was: /usr/java/jdk1.8.0_20/jre/../bin/javadoc @options @packages
I have tried everything possible and tried to search on Google for a long time, but no success. I have found links, where people had similar problems, but without any information about possible solution:
我已经尝试了所有可能的方法,试着在谷歌上搜索很长时间,但是没有成功。我找到了链接,在那里人们有类似的问题,但是没有任何关于可能的解决方案的信息:
http://marc.info/?l=maven-user&m=139615350913286&w=2
http://marc.info/?l=maven-user&m=139615350913286&w=2
http://mail-archives.apache.org/mod_mbox/maven-users/201409.mbox/%3C54101E24.6060304@gmx.de%3E (suggesting to update JDK8 to > update 20, which I did, but problem is still the same).
(建议更新JDK8到>更新20,我做了,但问题仍然是相同的)。
Any hints or anyone experienced this kind of behavior as well (unfortunately it looks as quite "rare" problem for some reason)? Quite desperate about this...
任何提示或任何人都经历过这种行为(不幸的是,由于某种原因,它看起来是很“罕见”的问题)?很绝望…
5 个解决方案
#1
64
This appears to be due to javax.transaction.Transactional
(or any other class in your classpath for that matter) being itself annotated with javax.interceptor.InterceptorBinding
, which is missing in classpath unless explicitly declared in dependencies:
这似乎是由于javax.transaction。事务性(或您的类路径中的任何其他类)使用javax.interceptor.InterceptorBinding,它在类路径中丢失,除非在依赖项中显式声明:
@Inherited
@InterceptorBinding // <-- this ONE is causing troubles
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Transactional {
Said that:
说:
-
javax.transaction.Transactional
- comes with javax.transaction:javax.transaction-api:1.+ (ororg.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final
) and is typically used in JPA/ORM/JMS apps to annotate transactional methods. - javax.transaction。事务性-附带javax.transaction:javax.transaction-api:1。在JPA/ORM/JMS应用程序中通常使用的是注释事务方法。
-
javax.interceptor.InterceptorBinding
- should come with javax.interceptor:javax.interceptor-api:1.+. But, although declared on top ofTransactional
, is not required for normal operation and (looks like because of this) is not getting fetched as a transitive dependency of your JPA framework. - 拦截器。拦截器绑定-应该使用javax.interceptor:javax.interceptor-api:1.+。但是,尽管在事务性之上声明,并不需要正常的操作,(看起来就像这样)并不是您的JPA框架的传递依赖。
As a result JDK8 javadoc tool fails to process the sources (if any of them are annotated with @Transactional
).
因此,JDK8 javadoc工具无法处理源(如果其中的任何一个被注释为@Transactional)。
Although it could be more specific about the place where this "error" has been found.
虽然它可以更具体地描述这个“错误”被发现的地方。
Issue fix: adding javax.interceptor:javax.interceptor-api:1.+
dependency fixes the issue.
问题修复:添加javax.interceptor:javax.interceptor-api:1.+依赖关系解决这个问题。
#2
7
You can also add the following line to your javadoc maven configuration: <failOnError>false</failOnError>
. This will tell the javadoc execution to ignore all errors and not let the build fail.
您还可以在javadoc maven配置中添加以下代码:
Your complete javadoc plugin config would therefore look like this:
因此,完整的javadoc插件配置将是这样的:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
#3
7
As @kozlovda already mentions, the issue comes with the @Transactional
annotation (javax.transaction.Transactional
).
正如@kozlovda已经提到的,这个问题来自@Transactional注释(javax.transaction.Transactional)。
If you have the described error on a Maven run for a Spring application, there is also another way to resolve the issue: Make sure not to use the the annotation from javax.transaction
, instead use org.springframework.transaction.annotation.Transactional
.
如果在一个Spring应用程序的Maven运行中有一个被描述的错误,那么还有另一种方法来解决这个问题:确保不要使用javax的注释。事务,而不是使用org.springframework.transaction.annotation.Transactional。
Replacing the import fixed the issue for me.
代替进口解决了我的问题。
#4
1
With proper credit to @lpratlong here's the full entry for impatient people like me to copy-paste:
有了正确的信用,@lpratlong这是我的完整条目,像我这样的不耐烦的人复制粘贴:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<!-- <version>3.0.0</version> -->
<configuration>
<!-- Silence error javax.interceptor.InterceptorBinding not found -->
<additionalDependencies>
<additionalDependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
<version>1.2</version>
</additionalDependency>
</additionalDependencies>
</configuration>
</plugin>
The version is commented out because in my case spring-boot manages the version, just restore as needed.
这个版本被注释掉了,因为在我的例子中,spring-boot管理这个版本,只是在需要的时候恢复。
#5
-3
You can also add Maven dependency to your POM file. It solved this problem for me
还可以向POM文件添加Maven依赖项。它帮我解决了这个问题。
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
#1
64
This appears to be due to javax.transaction.Transactional
(or any other class in your classpath for that matter) being itself annotated with javax.interceptor.InterceptorBinding
, which is missing in classpath unless explicitly declared in dependencies:
这似乎是由于javax.transaction。事务性(或您的类路径中的任何其他类)使用javax.interceptor.InterceptorBinding,它在类路径中丢失,除非在依赖项中显式声明:
@Inherited
@InterceptorBinding // <-- this ONE is causing troubles
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Transactional {
Said that:
说:
-
javax.transaction.Transactional
- comes with javax.transaction:javax.transaction-api:1.+ (ororg.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final
) and is typically used in JPA/ORM/JMS apps to annotate transactional methods. - javax.transaction。事务性-附带javax.transaction:javax.transaction-api:1。在JPA/ORM/JMS应用程序中通常使用的是注释事务方法。
-
javax.interceptor.InterceptorBinding
- should come with javax.interceptor:javax.interceptor-api:1.+. But, although declared on top ofTransactional
, is not required for normal operation and (looks like because of this) is not getting fetched as a transitive dependency of your JPA framework. - 拦截器。拦截器绑定-应该使用javax.interceptor:javax.interceptor-api:1.+。但是,尽管在事务性之上声明,并不需要正常的操作,(看起来就像这样)并不是您的JPA框架的传递依赖。
As a result JDK8 javadoc tool fails to process the sources (if any of them are annotated with @Transactional
).
因此,JDK8 javadoc工具无法处理源(如果其中的任何一个被注释为@Transactional)。
Although it could be more specific about the place where this "error" has been found.
虽然它可以更具体地描述这个“错误”被发现的地方。
Issue fix: adding javax.interceptor:javax.interceptor-api:1.+
dependency fixes the issue.
问题修复:添加javax.interceptor:javax.interceptor-api:1.+依赖关系解决这个问题。
#2
7
You can also add the following line to your javadoc maven configuration: <failOnError>false</failOnError>
. This will tell the javadoc execution to ignore all errors and not let the build fail.
您还可以在javadoc maven配置中添加以下代码:
Your complete javadoc plugin config would therefore look like this:
因此,完整的javadoc插件配置将是这样的:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
<failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>
</build>
#3
7
As @kozlovda already mentions, the issue comes with the @Transactional
annotation (javax.transaction.Transactional
).
正如@kozlovda已经提到的,这个问题来自@Transactional注释(javax.transaction.Transactional)。
If you have the described error on a Maven run for a Spring application, there is also another way to resolve the issue: Make sure not to use the the annotation from javax.transaction
, instead use org.springframework.transaction.annotation.Transactional
.
如果在一个Spring应用程序的Maven运行中有一个被描述的错误,那么还有另一种方法来解决这个问题:确保不要使用javax的注释。事务,而不是使用org.springframework.transaction.annotation.Transactional。
Replacing the import fixed the issue for me.
代替进口解决了我的问题。
#4
1
With proper credit to @lpratlong here's the full entry for impatient people like me to copy-paste:
有了正确的信用,@lpratlong这是我的完整条目,像我这样的不耐烦的人复制粘贴:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<!-- <version>3.0.0</version> -->
<configuration>
<!-- Silence error javax.interceptor.InterceptorBinding not found -->
<additionalDependencies>
<additionalDependency>
<groupId>javax.interceptor</groupId>
<artifactId>javax.interceptor-api</artifactId>
<version>1.2</version>
</additionalDependency>
</additionalDependencies>
</configuration>
</plugin>
The version is commented out because in my case spring-boot manages the version, just restore as needed.
这个版本被注释掉了,因为在我的例子中,spring-boot管理这个版本,只是在需要的时候恢复。
#5
-3
You can also add Maven dependency to your POM file. It solved this problem for me
还可以向POM文件添加Maven依赖项。它帮我解决了这个问题。
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>