JDK8 - 找不到javax.interceptor.InterceptorBinding的错误“类文件”尝试使用Maven javadoc插件生成javadoc时 [英] JDK8 - Error "class file for javax.interceptor.InterceptorBinding not found" when trying to generate javadoc using Maven javadoc plugin

查看:1882
本文介绍了JDK8 - 找不到javax.interceptor.InterceptorBinding的错误“类文件”尝试使用Maven javadoc插件生成javadoc时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JDK8(在我的Eclipse工作区上尝试使用Jenkins推出的Linux上的Win x64 u25 JDK + - jdk-8u20-linux-x64,两者都有同样的问题。)

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).

我有多模块Maven项目(我从包装类型为pom的主模块启动Maven目标javadoc:aggregate)。

I have multi-module Maven project (I am launching Maven goal "javadoc:aggregate" from a main module with packaging type "pom").

Pom构建部分如下所示:

Pom build section looks like this:

<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>

我总是收到错误:

[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

我已尽力尝试一切,并试图在Google上搜索很长时间,但没有成功。
我找到了人们遇到类似问题的链接,但没有任何关于可能的解决方案的信息:

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:/ /mail-archives.apache.org/mod_mbox/maven-users/201409.mbox/%3C54101E24.6060304@gmx.de%3E (建议将JDK8更新为>更新20,我做了,但问题是仍然一样)。

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).

任何提示或任何人都会遇到这种行为(不幸的是,由于某些原因,它看起来非常罕见)?
非常绝望...

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...

推荐答案

这似乎是由于 javax。 transaction.Transactional (或类路径中的任何其他类)本身用 javax.interceptor.InterceptorBinding 注释,类路径中缺少除非在依赖项中明确声明:

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:

@Inherited
@InterceptorBinding // <-- this ONE is causing troubles
@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(value = RetentionPolicy.RUNTIME)
public @interface Transactional {

表示:


  • javax。 transaction.Transactional - 附带 javax.transaction:javax.transaction-api:1。+ (或 org。 jboss.spec.ja vax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final )并且通常在JPA / ORM / JMS应用程序中用于注释事务方法。

  • javax.interceptor.InterceptorBinding - 应附带 javax.interceptor:javax.interceptor-api:1. + 。但是,尽管在 Transactional 之上声明,但是正常操作不需要(看起来像这样),因为它不会被作为JPA框架的传递依赖项获取。 / li>
  • javax.transaction.Transactional - comes with javax.transaction:javax.transaction-api:1.+ (or org.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.interceptor.InterceptorBinding - should come with javax.interceptor:javax.interceptor-api:1.+. But, although declared on top of Transactional, is not required for normal operation and (looks like because of this) is not getting fetched as a transitive dependency of your JPA framework.

因此JDK8 javadoc工具无法处理源(如果其中任何一个用 @Transactional <注释/ code>)。

As a result JDK8 javadoc tool fails to process the sources (if any of them are annotated with @Transactional).

虽然可能更具体地说明了发现此错误的地方。

Although it could be more specific about the place where this "error" has been found.

问题修复:添加 javax.interceptor:javax.interceptor-api:1。+ 依赖项解决问题。

Issue fix: adding javax.interceptor:javax.interceptor-api:1.+ dependency fixes the issue.

<dependency>
    <groupId>javax.interceptor</groupId>
    <artifactId>javax.interceptor-api</artifactId>
    <version>1.2</version>
</dependency>

这篇关于JDK8 - 找不到javax.interceptor.InterceptorBinding的错误“类文件”尝试使用Maven javadoc插件生成javadoc时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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