0

Below are the errors we are encountering after the maven build in a project:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project test1: Compilation failure: Compilation failure
&
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.5.0:jar (attach-javadocs) on project test2: Error while generating Javadoc

I am expecting solution to the above errors because we are Migrating Java from JDK8 to JDK17. I was wondering if someone could help me here with the solution.

[INFO] BUILD FAILURE
[INFO] -------------------------------------------------------------- 
----------
[INFO] Total time: 50.144 s
[INFO] Finished at: 2023-08-22T15:19:41+05:30
[INFO] Final Memory: 47M/174M
[INFO] -------------------------------------------------------------- 
----------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven- 
javadoc-plugin:3.5.0:jar (attach-javadocs) on project esymac: 
MavenReportException: Error while generating Javadoc:
[ERROR] Exit code:1 
  


[ERROR]/home/soumya/trunk/joma/esymac/src/main/java/com/nokia/j2ssp/comp/esymac/api/FaultManagerFactory.java:21: error: cannot find symbol
    [ERROR] import com.nokia.j2ssp.comp.esymac.fm.FaultManagerAIFRemote;
    
    [ERROR] symbol:   class FaultManagerAIFRemote
    [ERROR] location: package com.nokia.j2ssp.comp.esymac.fm
    [ERROR] /home/soumya/trunk/joma/esymac/src/main/java/com/nokia/j2ssp/comp/esymac/api/FaultManagerFactory.java:22: error: cannot find symbol
    [ERROR] import com.nokia.j2ssp.comp.esymac.util.Configuration;

Parent pom.xml:

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
</properties>
<modules>
    <module>joma</module>
</modules>
<build>
<pluginManagement>
    <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
        <configuration>
            <!--<source>17</source>
            <target>17</target>-->
            <release>17</release>
        </configuration>
    </plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
Soumya
  • 27
  • 3

1 Answers1

2

I see that you use maven-compiler-plugin of version 3.8.0, and as soon as you say that you are migrating from JDK 8 to JDK 17 you probably need to upgrade plugin to version 3.10.1 and specify Java language level in <properties/> section of your pom.xml:

<properties>
  <maven.compiler.release>17</maven.compiler.release>
</properties>

Also have a look into you code, compilation error might have been caused by some API which is unavailable after migration. It'd nice if you attach more information about compilation error.

Pay attention to the version of Lombok, you probably need to upgrade it as well. In general your issue looks like this one Java 17: Maven doesn't give much information about the error that happened, why?

P.S. From your error

[ERROR]/home/soumya/trunk/joma/esymac/src/main/java/com/nokia/j2ssp/comp/esymac/api/FaultManagerFactory.java:21: error: cannot find symbol
    [ERROR] import com.nokia.j2ssp.comp.esymac.fm.FaultManagerAIFRemote;
    
    [ERROR] symbol:   class FaultManagerAIFRemote
    [ERROR] location: package com.nokia.j2ssp.comp.esymac.fm
    [ERROR] /home/soumya/trunk/joma/esymac/src/main/java/com/nokia/j2ssp/comp/esymac/api/FaultManagerFactory.java:22: error: cannot find symbol
    [ERROR] import com.nokia.j2ssp.comp.esymac.util.Configuration;

I suspect that these classes (FaultManagerFactory, FaultManagerAIFRemote etc.) are missing from the compile class path. Are they coming from a library or generated on the fly? If the latter, try to figure out why they are not generated after migration.

Sergey Tsypanov
  • 3,265
  • 3
  • 8
  • 34