Home > Back-end >  While building the project getting error , Failed to execute goal org.apache.maven.plugins:maven-jav
While building the project getting error , Failed to execute goal org.apache.maven.plugins:maven-jav

Time:11-20

<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>com.example.commons</groupId>
    <artifactId>commons-parent</artifactId>
    <version>0.0.68-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>commons-parent</name>
    <description>commons-parent</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.RELEASE</version>
    </parent>

    <modules>
        <module>commons-it</module>
        <module>commons-client</module>
        <module>commons-error</module>
        <module>commons-ssm</module>
        <module>commons-cache</module>
        <module>commons-model</module>
        <module>commons-mq</module>
        <module>commons-jsonb-gson</module>
        <module>commons-util</module>
    </modules>

    <distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>Nexus</id>
            <name>example release repository</name>
            <!--  We can not use vc.example.com here because it is not visible for Jenkins running on AWS. -->
            <url>nexus url</url>
            <layout>default</layout>
        </repository>
        <snapshotRepository>
            <uniqueVersion>false</uniqueVersion>
            <id>nexus-snapshots</id>
            <name>example snapshot repository</name>
            <!--  We can not use vc.example.com here because it is not visible for Jenkins running on AWS. -->
            <url>nexus url</url>
            <layout>default</layout>
        </snapshotRepository>
    </distributionManagement>

    <!-- FIXME: Update with the correct settings -->
    <ciManagement>
        <url>ci-url</url>
    </ciManagement>

    <scm>
        <url>https://github.com/example/abc-backend-commons</url>
        <connection>scm:git:git://github.com/example/abc-backend-commons.git</connection>
        <developerConnection>scm:git:[email protected]:example/abc-backend-commons.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <inceptionYear>2017</inceptionYear>

    <organization>
        <name>example Inc</name>
        <url>https://www.example.com/</url>
    </organization>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>

        <!-- JMeter properties (defaulted - can be override via command line
            args) -->
        <host>localhost</host>
        <port>8080</port>

        <!-- CI settings -->
        <ci.build>${BUILD_NUMBER}</ci.build>
        <ci.url>${BUILD_URL}</ci.url>

        <org.apache.commons.lang3.version>3.4</org.apache.commons.lang3.version>

        <org.hibernate.javax.persistence>1.0.0.Final</org.hibernate.javax.persistence>

        <org.flywaydb.version>4.2.0</org.flywaydb.version>

        <com.github.docker-java.version>3.0.13</com.github.docker-java.version>

        <com.amazonaws.version>1.11.225</com.amazonaws.version>

        <apache.httpclient.version>4.5.5</apache.httpclient.version>

        <spring.framework.version>4.3.10.RELEASE</spring.framework.version>

        <gson.version>2.8.4</gson.version>

        <spring.jms.version>4.3.10.RELEASE</spring.jms.version>

        <apache.activemq.pool.version>5.15.8</apache.activemq.pool.version>

        <swagger.annotation.version>1.5.13</swagger.annotation.version>

        <javax.validation.version>1.1.0.Final</javax.validation.version>

        <postgresql.version>42.2.2</postgresql.version>

        <hibernate.version>5.4.23.Final</hibernate.version>

    </properties>

    <dependencyManagement>

        <dependencies>

            <!-- Manage local dependencies -->

            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-it</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-client</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-error</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-ssm</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-cache</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-model</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-mq</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-jsonb-gson</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.example.commons</groupId>
                <artifactId>commons-util</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.zaxxer</groupId>
                <artifactId>HikariCP</artifactId>
                <version>2.7.8</version>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgresql.version}</version>
            </dependency>
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-core</artifactId>
                <version>${org.flywaydb.version}</version>
            </dependency>

            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-s3</artifactId>
                <version>${com.amazonaws.version}</version>
            </dependency>
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-ssm</artifactId>
                <version>${com.amazonaws.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${org.apache.commons.lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.docker-java</groupId>
                <artifactId>docker-java</artifactId>
                <version>${com.github.docker-java.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${apache.httpclient.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.framework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.framework.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jms</artifactId>
                <version>${spring.jms.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-pool</artifactId>
                <version>${apache.activemq.pool.version}</version>
            </dependency>

            <dependency>
                <groupId>io.swagger</groupId>
                <artifactId>swagger-annotations</artifactId>
                <version>${swagger.annotation.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>${javax.validation.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${hibernate.version}</version>
            </dependency>

        </dependencies>

    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>dockerfile-maven-plugin</artifactId>
                    <version>1.3.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <additionalparam>${javadoc.opts}</additionalparam>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <reportPlugins>
                            <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-javadoc-plugin</artifactId>
                                <configuration>
                                    <additionalparam>${javadoc.opts}</additionalparam>
                                </configuration>
                            </plugin>
                        </reportPlugins>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>

            <!-- JUnit tests -->
            <!-- exclude integration tests from normal build -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/*IT.java</exclude>
                        <exclude>**/*IntegrationTest.java</exclude>
                        <exclude>**/*ST.java</exclude>
                        <exclude>**/*SpecTest.java</exclude>
                        <exclude>**/*SpecificationTest.java</exclude>
                        <exclude>**/*Spec.java</exclude>
                        <exclude>**/*Specification.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>

            <!-- JavaDoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Manifest -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <!-- Manifest -->
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addClasspath>false</addClasspath>
                            <classpathPrefix>lib</classpathPrefix>
                        </manifest>
                        <manifestEntries>
                            <Specification-Title>${project.name}</Specification-Title>
                            <Specification-Version>${project.version}</Specification-Version>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <!-- This plug in is needed if jdk 11 is installed to avoid error 'The code being
            documented uses modules but the packages defined in
            http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.'-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <source>8</source>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- Maven site reports -->
    <reporting>
        <plugins>

            <plugin>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
            </plugin>

            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.4</version>
            </plugin>

            <plugin>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>2.5</version>
            </plugin>

            <plugin>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>3.8</version>
            </plugin>

            <plugin>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.5</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.9</version>

                <configuration>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>

                <!-- To view the maven site, mvn site (-o if too slow), to
                    deploy to a repo mvn site-deploy, to check all modules locally site:stage -->
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>summary</report>
                            <report>cim</report>
                            <report>dependencies</report>
                            <report>dependency-convergence</report>
                            <report>dependency-info</report>
                            <report>dependency-management</report>
                            <report>distribution-management</report>
                            <report>issue-tracking</report>
                            <report>license</report>
                            <report>mailing-list</report>
                            <report>project-team</report>
                            <report>scm</report>
                            <report>modules</report>
                            <report>plugins</report>
                            <report>help</report>
                        </reports>
                    </reportSet>
                </reportSets>

            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- When the app runs outside of a CI server then we don't have
            access to certain properties, so we just give defaults -->
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>default-property-setter</name>
                </property>
            </activation>

            <!-- default values, please adjust or use the spring Value default -->
            <properties>
                <ci.build>unknown</ci.build>
                <ci.url>unknown</ci.url>
            </properties>
        </profile>
        <profile>
            <id>java8-doclint-disabled</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <javadoc.opts>-Xdoclint:none</javadoc.opts>
            </properties>
        </profile>
    </profiles>

</project>

getting error(Using java 1.8 to build)

Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project commons-parent: Execution attach-javadocs of goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar: java.lang.ExceptionInInitializerError: null

tried many things nothing is working could anyone look and help.

CodePudding user response:

First, try upgrading the maven-javadoc-plugin version.

If that doesn't work...

(1) Make sure the project builds without the maven-javadoc-plugin.

mvn -Dmaven.javadoc.skip=true verify

(2) Disable strict linting.

This is for version 3.0.0 .

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <version>...</version>

  <configuration>
    <additionalOptions>
      <additionalOption>-Xdoclint:none</additionalOption>
    </additionalOptions>
  </configuration>
</plugin>

If (2) works, then there is most likely a problem with your Javadoc. Is there more to the build logs that may indicate where?

  • Related