简体   繁体   English

如何在javadoc:fix中修复“ MavenInvocationException”

[英]How to fix “MavenInvocationException” in javadoc:fix

I'm getting this Exception if I try to execute the goal javadoc:fix. 如果尝试执行目标javadoc:fix,则会收到此异常。

Execution default-cli of goal org.codehaus.mojo:clirr-maven-plugin:2.2.2:check failed: Invalid byte tag in constant pool: 15

If I remove all sourcecode from the src/main/java location it works perfectly fine. 如果我从src / main / java位置删除所有源代码,则可以正常工作。 If I add a new class to the empty directory it works fine. 如果我将新类添加到空目录中,则可以正常工作。 But when I revert the deletion the error comes back. 但是,当我还原删除内容时,错误会再次出现。

So I think my sourcecode is "broken" where have I to search to find the "broken" file ? 所以我认为我的源代码是“损坏的”,我应该在哪里搜索以找到“损坏的”文件?

Here is the pom.xml: 这是pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>some.id</groupId>
    <artifactId>some-arti-id</artifactId>
    <version>1.0.4</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.codehaus.mojo/clirr-maven-plugin -->


        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <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-jar-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/log4j.properties</exclude>
                    </excludes>
                    <archive>
                        <manifest>
                            <mainClass>some.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <defaultAuthor>Author</defaultAuthor>
                    <defaultVersion>${project.version}</defaultVersion>
                    <version>true</version>
                    <author>true</author>
                </configuration>
                <executions>
                    <execution>
                        <id>update</id>
                        <goals>
                            <goal>fix</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>javadoc</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.28</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.28</version>
        </dependency>

        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.12.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>

    </dependencies>


</project>

Here is the full stack trace: 这是完整的堆栈跟踪:

org.apache.maven.shared.invoker.MavenInvocationException: Error when invoking Maven, consult the invoker log file: C:\some\folder\target\invoker\clirr-maven-plugin2009217175.txt
    at org.apache.maven.plugins.javadoc.JavadocUtil.invokeMaven (JavadocUtil.java:886)
    at org.apache.maven.plugins.javadoc.AbstractFixJavadocMojo.executeClirr (AbstractFixJavadocMojo.java:700)
    at org.apache.maven.plugins.javadoc.AbstractFixJavadocMojo.execute (AbstractFixJavadocMojo.java:448)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

And in the File there is this Exception:

Execution default-cli of goal org.codehaus.mojo:clirr-maven-plugin:2.2.2:check failed: Invalid byte tag in constant pool: 15 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:clirr-maven-plugin:2.2.2:check (default-cli) on project net-wittlich-test: Execution default-cli of goal org.codehaus.mojo:clirr-maven-plugin:2.2.2:check failed: Invalid byte tag in constant pool: 15
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.codehaus.mojo:clirr-maven-plugin:2.2.2:check failed: Invalid byte tag in constant pool: 15
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
    at org.apache.bcel.classfile.Constant.readConstant (Constant.java:146)
    at org.apache.bcel.classfile.ConstantPool.<init> (ConstantPool.java:67)
    at org.apache.bcel.classfile.ClassParser.readConstantPool (ClassParser.java:222)
    at org.apache.bcel.classfile.ClassParser.parse (ClassParser.java:136)
    at org.apache.bcel.util.ClassLoaderRepository.loadClass (ClassLoaderRepository.java:94)
    at org.apache.bcel.classfile.JavaClass.getSuperClass (JavaClass.java:762)
    at org.apache.bcel.classfile.JavaClass.getAllInterfaces (JavaClass.java:803)
    at net.sf.clirr.core.internal.bcel.BcelJavaType.getAllInterfaces (BcelJavaType.java:78)
    at net.sf.clirr.core.internal.checks.InterfaceSetCheck.check (InterfaceSetCheck.java:58)
    at net.sf.clirr.core.Checker.runClassChecks (Checker.java:190)
    at net.sf.clirr.core.Checker.reportDiffs (Checker.java:136)
    at org.codehaus.mojo.clirr.AbstractClirrMojo.executeClirr (AbstractClirrMojo.java:236)
    at org.codehaus.mojo.clirr.AbstractClirrMojo.executeClirr (AbstractClirrMojo.java:182)
    at org.codehaus.mojo.clirr.ClirrCheckMojo.execute (ClirrCheckMojo.java:68)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

If I clear my local repo I get only a Warning "[WARNING] No previous artifact has been deployed, Clirr is ignored." 如果清除本地存储库,只会收到警告“ [警告]尚未部署以前的工件,Clirr将被忽略。”

But as soon I change the Version higher and there a two versions of my artifact in my repo I still get the error. 但是,一旦我将Version更改为更高版本,并且在我的仓库中有两个版本的工件,我仍然会收到错误消息。

I think I have found the important part in the javadoc-maven-plugin https://github.com/apache/maven-javadoc-plugin/blob/master/src/main/java/org/apache/maven/plugins/javadoc/AbstractFixJavadocMojo.java 我想我已经在javadoc-maven-plugin https://github.com/apache/maven-javadoc-plugin/blob/master/src/main/java/org/apache/maven/plugins/javadoc中找到了重要的部分/AbstractFixJavadocMojo.java

Line: 193-205 - Why it is hardcoded ? 行:193-205-为什么要对其进行硬编码? Line: 450 The Try / catch to execute the Clirr 行:450尝试/捕获以执行Clirr

According to the stacktrace the actual library causing problems is bcel. 根据stacktrace,导致问题的实际库是bcel。 It might work if you add a new version as plugin dependency to your maven config. 如果您将新版本作为插件依赖项添加到您的maven配置中,则可能会起作用。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <!-- .... other stuff -->
    <dependencies>
      <dependency>
         <groupId>org.apache.bcel</groupId>
         <artifactId>bcel</artifactId>
         <version>6.3.1</version>
      </dependency>
    </dependencies>
</plugin>

If that doesn't work, i would go for this workaround. 如果那不起作用,我将寻求解决方法。 Find the classes that causes the problem and exclude them. 查找导致问题的类并排除它们。

To find the classes that cause problems: 查找导致问题的类:

  1. Add an exception breakpoint to org.apache.bcel.classfile.ClassFormatException 将异常断点添加到org.apache.bcel.classfile.ClassFormatException
  2. Start the maven generation in debug mode 在调试模式下启动Maven生成
  3. Wait till the breakpoint is reached 等到断点到达
  4. Look at the org.apache.bcel.classfile.ClassParser.parse activation frame, i would expect to see the classname in one of the variables or fields. 看一下org.apache.bcel.classfile.ClassParser.parse激活框架,我希望在变量或字段之一中看到类名。 (Maybe you need to look around further down the stack). (也许您需要在堆栈中进一步查看)。
  5. Exclude the class (maybe the whole package) 排除课程(可能是整个课程)
  6. Repeat at 2 在2重复

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 看不到 javadoc 信息。 我如何解决它? - Can't see javadoc information. How do I fix it? Intellij 如何修复“javadoc:错误 - 无效标志:--source-path” - Intellij how to fix "javadoc: error - invalid flag: --source-path" 如何修复“非法开始的表达式缺少 javadoc”错误 - How to I fix an ''illegal start of expressionMissing javadoc" error 如何修复不再自动填充/自动完成的Javadoc? - How do I fix Javadoc that no longer autofills/autocompletes? Maven Javadoc插件仅修复现有的Javadocs - Maven javadoc plugin fix only existing javadocs maven javadoc:修复无法自动修复文档 - maven javadoc:fix fails to autofix docs 如何修复 Javadoc 注释解析错误,详细信息:在解析 JAVADOC_TAG [NonEmptyAtClauseDescription] 时在输入“*”处没有可行的替代方案 - How to fix Javadoc comment has parse error, Details: no viable alternative at input ' *' while parsing JAVADOC_TAG [NonEmptyAtClauseDescription] Gradle中的注释处理器将源文件输出到构建/类,使javadoc失败。怎么解决? - Annotation processor in Gradle outputs source files to build/classes making javadoc fail. How to fix it? 为什么 mvn javadoc:fix 显示成功,而在同一个项目中 mvn javadoc:javadoc 之后失败? - Why mvn javadoc:fix shows success while in the same project mvn javadoc:javadoc fails afterwards? 如何修复JPanel循环? - How to fix JPanel loop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM