unable to build maven project due to javadoc error?

后端 未结 6 930
离开以前
离开以前 2021-02-01 13:33

has anyone come across a simlar maven error below?

i am unable to build my project due to the error below. All was working previously fine before i started working on th

相关标签:
6条回答
  • 2021-02-01 13:40

    UPDATE FOR THOSE WHO GOOGLED THIS BUG: If the project uses source/target 8, adding 8 in javadoc configuration should make the project buildable on jdk {11, 12, 13}:

    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
      <source>8</source>
    </configuration>
     ...
    

    0 讨论(0)
  • 2021-02-01 13:41

    With maven-javadoc-plugin version 3.0.0 <additionalparam/> has been replaced by <additionalOptions/>. To reduce the errors to warnings this pom.xml entry worked for me:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <additionalOptions>
                        <additionalOption>-Xdoclint:none</additionalOption>
                    </additionalOptions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    0 讨论(0)
  • 2021-02-01 13:41

    Just update your pom.xml with the properties tag, given below.

    <properties>
        <additionalparam>-Xdoclint:none</additionalparam>
    </properties>
    
    0 讨论(0)
  • 2021-02-01 13:45

    I'm guessing you switched to Java 8. In this version Javadoc is stricter on the requirements.

    You have three choices:

    1. Fix the errors
    2. disable the strict checking
    3. skip Javadoc when building

    To disable the strict checking, add this to your pom.xml

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <additionalparam>-Xdoclint:none</additionalparam>
        </configuration>
      </plugin>
    </plugins>
    

    to skip Javadoc while building, use this:

    mvn -Dmaven.javadoc.skip=true verify
    

    Further Information

    0 讨论(0)
  • 2021-02-01 13:48

    As mentioned by @turbanoff since version 3.0.0 the maven-javadoc-plugin config setting <additionalparam> has been replaced by <additionalOptions>

    So the plugin defintion in your pom.xml can look like this:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.2.0</version>
        <configuration>
            <additionalOptions>-Xdoclint:none</additionalOptions>
        </configuration>
    </plugin>
    

    This configuration will still generate the warnings. So you can and should fix them in your code. But it will now no longer break the maven build.

    0 讨论(0)
  • 2021-02-01 13:54

    None of the above options seemed to work for me when using version 3.2.0. Instead I noticed the failOnError option. Setting this tags value to false seemed to do the trick for allowing my build to succeed even when there were javadoc errors.

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
    

    This will stop the javadoc jar from being generated for the maven project. This was okay in my case as I was only wanting to build without errors during ongoing development. The other options may still allow for the javadoc jar to be generated when there are errors.

    0 讨论(0)
提交回复
热议问题