9

I am trying to do a mvn clean package to my Maven Springboot Project but I see the following message. What can be the reason? I already searched everything on the internet; it is a common situation but nobody has a definitive solution which can be useful for me.

My maven version is 3.6.3; I tried to do this from command line; my o.s. is Linux Mint Cinnamnon latest; my java is OpendJDK 11.0.5; maven compiler plugin 3.8.0.

[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/home/user/.sdkman/candidates/maven/current/conf/logging/
constituent[1]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-model-builder-3.6.3.jar
constituent[2]: file:/home/user/.sdkman/candidates/maven/current/lib/commons-io-2.5.jar
constituent[3]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-model-3.6.3.jar
constituent[4]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-settings-3.6.3.jar
constituent[5]: file:/home/user/.sdkman/candidates/maven/current/lib/jcl-over-slf4j-1.7.29.jar
constituent[6]: file:/home/user/.sdkman/candidates/maven/current/lib/cdi-api-1.0.jar
constituent[7]: file:/home/user/.sdkman/candidates/maven/current/lib/wagon-http-3.3.4-shaded.jar
constituent[8]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-embedder-3.6.3.jar
constituent[9]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-api-1.4.1.jar
constituent[10]: file:/home/user/.sdkman/candidates/maven/current/lib/wagon-provider-api-3.3.4.jar
constituent[11]: file:/home/user/.sdkman/candidates/maven/current/lib/plexus-interpolation-1.25.jar
constituent[12]: file:/home/user/.sdkman/candidates/maven/current/lib/guice-4.2.1-no_aop.jar
constituent[13]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-slf4j-provider-3.6.3.jar
constituent[14]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-connector-basic-1.4.1.jar
constituent[15]: file:/home/user/.sdkman/candidates/maven/current/lib/org.eclipse.sisu.plexus-0.3.4.jar
constituent[16]: file:/home/user/.sdkman/candidates/maven/current/lib/plexus-cipher-1.7.jar
constituent[17]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-shared-utils-3.2.1.jar
constituent[18]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-artifact-3.6.3.jar
constituent[19]: file:/home/user/.sdkman/candidates/maven/current/lib/plexus-sec-dispatcher-1.4.jar
constituent[20]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-impl-1.4.1.jar
constituent[21]: file:/home/user/.sdkman/candidates/maven/current/lib/org.eclipse.sisu.inject-0.3.4.jar
constituent[22]: file:/home/user/.sdkman/candidates/maven/current/lib/slf4j-api-1.7.29.jar
constituent[23]: file:/home/user/.sdkman/candidates/maven/current/lib/guava-25.1-android.jar
constituent[24]: file:/home/user/.sdkman/candidates/maven/current/lib/plexus-component-annotations-2.1.0.jar
constituent[25]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-core-3.6.3.jar
constituent[26]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-plugin-api-3.6.3.jar
constituent[27]: file:/home/user/.sdkman/candidates/maven/current/lib/jsr250-api-1.0.jar
constituent[28]: file:/home/user/.sdkman/candidates/maven/current/lib/plexus-utils-3.2.1.jar
constituent[29]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-repository-metadata-3.6.3.jar
constituent[30]: file:/home/user/.sdkman/candidates/maven/current/lib/jsoup-1.12.1.jar
constituent[31]: file:/home/user/.sdkman/candidates/maven/current/lib/commons-lang3-3.8.1.jar
constituent[32]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-compat-3.6.3.jar
constituent[33]: file:/home/user/.sdkman/candidates/maven/current/lib/commons-cli-1.4.jar
constituent[34]: file:/home/user/.sdkman/candidates/maven/current/lib/wagon-file-3.3.4.jar
constituent[35]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-transport-wagon-1.4.1.jar
constituent[36]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-settings-builder-3.6.3.jar
constituent[37]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-util-1.4.1.jar
constituent[38]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-spi-1.4.1.jar
constituent[39]: file:/home/user/.sdkman/candidates/maven/current/lib/javax.inject-1.jar
constituent[40]: file:/home/user/.sdkman/candidates/maven/current/lib/jansi-1.17.1.jar
constituent[41]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-builder-support-3.6.3.jar
constituent[42]: file:/home/user/.sdkman/candidates/maven/current/lib/maven-resolver-provider-3.6.3.jar
---------------------------------------------------
Exception in thread "main" java.lang.AssertionError
    at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
    at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
    at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:247)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:837)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1529)
    at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
    at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1140)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1066)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:237)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:993)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visit(Printer.java:136)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:199)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:167)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:185)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:167)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
    at jdk.compiler/com.sun.tools.javac.util.JCDiagnostic.getMessage(JCDiagnostic.java:788)
    at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.getMessage(ClientCodeWrapper.java:799)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:131)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1129)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:188)
    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:957)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)

And this is the previous part of the output

user@User-VirtualBox-Mint:~/Desktop/mycompany/myapp$ mvn clean package -U -Dwithout-frontend
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] myapp                                                             [pom]
[INFO] myapp-server                                                      [jar]
[INFO] 
[INFO] -----------------------< com.mycompany:myapp >------------------------
[INFO] Building myapp 1.0.0-SNAPSHOT                                     [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ myapp ---
[INFO] 
[INFO] --------------------< com.mycompany:myapp-server >--------------------
[INFO] Building myapp-server 1.0.0-SNAPSHOT                              [2/2]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ myapp-server ---
[INFO] Deleting /home/user/Desktop/mycompany/myapp/server/target
[INFO] 
[INFO] --- git-commit-id-plugin:2.2.6:revision (default) @ myapp-server ---
[INFO] 
[INFO] --- spring-boot-maven-plugin:2.1.7.RELEASE:build-info (default) @ myapp-server ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ myapp-server ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ myapp-server ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to /home/user/Desktop/mycompany/myapp/server/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for myapp 1.0.0-SNAPSHOT:
[INFO] 
[INFO] myapp ............................................. SUCCESS [  0.252 s]
[INFO] myapp-server ...................................... FAILURE [  4.913 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.494 s
[INFO] Finished at: 2019-12-12T14:48:34+01:00
[INFO] ------------------------------------------------------------------------
---------------------------------------------------

If I try to add javaccompilerforce use in my main pom.xml such that this part is as following

   <version>3.8.0</version>
      <configuration>
        <forceJavacCompilerUse>true</forceJavacCompilerUse>
        <compilerArgs>
          <arg>-parameters</arg>
        </compilerArgs>
      </configuration>
    </plugin>

I see this time this new error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project myapp-server: Compilation failure: Compilation failure: 
[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[8,38] error: package com.mycompany.myapp.exception does not exist
[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[25,84] error: cannot find symbol
[ERROR]   symbol:   class InvalidPropertyValueException
[ERROR]   location: class RestControllerAdvice
[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[25,24] error: cannot find symbol
[ERROR]   symbol:   class InvalidPropertyValueException
[ERROR]   location: class RestControllerAdvice
[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[24,20] error: cannot find symbol
[ERROR]   symbol:   class InvalidPropertyValueException
[ERROR]   location: class RestControllerAdvice
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :myapp-server

Really, is the reason of the problem the absence of one folder or package? Or this second row is simply related to the javaccompilerforce option itself and not with the core of the app? It seems me too strange or banal. And, in add, the exactly same app works perfectly in another computer.

Edit

Thanks to all for your time, I think, the problem is the absence of some components. I tried to add those and now the error message is changed. At this point, I am a little bit in trouble because I see this maven output:

[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[8,38] error: cannot find symbol
[ERROR]   symbol:   class InvalidPropertyValueException
[ERROR]   location: package com.mycompany.myapp.exception

So, I searched the 8 row in that file and I found this one

import org.springframework.web.bind.annotation.ExceptionHandler;

But, the line which is referred to InvalidPropertyValueException is 2 rows before:

import com.mycompany.myapp.exception.InvalidPropertyValueException;

And, the strange thing, in the package com.mycompanny.myapp.exception I didn't found any class or file named InvalidPropertyValueException. But Eclipse accept it and present me in the option list. And this class don't generate any error or red line.

Jeroen Steenbeeke
  • 3,884
  • 5
  • 17
  • 26
Archimede
  • 699
  • 3
  • 15
  • 28
  • 1
    have you tried "mvn test" and seen any test failures? – Roger Kreft Dec 12 '19 at 13:33
  • No, I tried immediately and inform you. Thank you very much. – Archimede Dec 12 '19 at 13:34
  • 1
    First please make a `mvn --version` on plain command line..second are you building inside IDE or on plain command line...furthermore on which OS which which JDK versions? – khmarbaise Dec 12 '19 at 13:35
  • Thank all, I really appreciate. | First, I tried mvn test and the error is the same. | Second, mvn version is 3.6.3. | 3nd, I tried to do this from command line; | Linux Mint Cinnamnon latest; | Java OpendJDK 11.0.5. Same configuration already worked correctly for other projects. – Archimede Dec 12 '19 at 13:38
  • 1
    perhaps this post will help you to understand https://stackoverflow.com/questions/46878649/maven-compilation-issue-with-java-9 – Devilluminati Dec 12 '19 at 13:40
  • Thank, I check immediately – Archimede Dec 12 '19 at 13:40
  • Thank, I check immediately. Ok read, No solutions there if I correctly understood, but only a way to see a more complete error message, right? I tried to add the row true but I see another error. Should I add this line in the "maven compiler plugin row" in my main pom.xml, right? Maybe I add it in the wrong location. Is this a way to see a more complete error, right? – Archimede Dec 12 '19 at 13:46
  • 1
    could you post your pom.xml? maybe we can see somthing there – Roger Kreft Dec 12 '19 at 13:55
  • 1
    I assume there is much more output before the snipped you have posted this part could be very interesting ...Apart from that requested to do `mvn --version` and update your post with those information you got...BTW: Which version of maven-compiler-plugin do you use? – khmarbaise Dec 12 '19 at 13:56
  • Ok. 1) Sure, I do, are you interested to the main pom.xml or to the pom.xml in the server submodule? (This is a multimodule Springboot + Angular web app, and I am working only to the server part, in the fact the frontend Angular part is definitely not a part of my problem and when I make mvn clean package I exclude it by -Dwithout-frontend) | Khm do you need the prevous part? No error there, only info output about the build. Thanks! – Archimede Dec 12 '19 at 13:59
  • Khm right, good idea, I immediately update the orginal post – Archimede Dec 12 '19 at 14:00
  • Maven compiler plugin 3.8.0! maven-compiler-plugin 3.8.0 -parameters – Archimede Dec 12 '19 at 14:03
  • But yes, now I put also the previous part of the output. Without any error, but I hope can be useful. I edit my original post now. – Archimede Dec 12 '19 at 14:09
  • 1
    Has com.sun.tools been removed from JDK 11? That would explain it. Did the projects that worked use JDK 8? – duffymo Dec 12 '19 at 14:24
  • Ok, I also added the row forcejavacompileruse as indicated in the link https://stackoverflow.com/questions/46878649/maven-compilation-issue-with-java-9. I see another message error, about a missing package. Maybe we are on the right way. I edit the original question. – Archimede Dec 12 '19 at 14:25
  • No Du, also the project which worked use the same. Ok, I edit the original question. Can you please explain me what do exactly the row javacforcecompiler and why I didn't see any message about missing folder before? – Archimede Dec 12 '19 at 14:27
  • Look please the second row of the 3nd code box, can be that this error is due to the developer forget to insert this package? It looks me too strange, because I have seen personally this app working fine in one other computer befor a push in our git repo. Thank --- --- --- [ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[8,38] error: package com.mycompany.myapp.exception does not exist – Archimede Dec 12 '19 at 14:37
  • Thanks all, tomorrow I will verify if the reason is the absence of some packages and I will update you here! Maybe (maybe) problem solved. – Archimede Dec 12 '19 at 15:24
  • Mmm I think the problem is changed, is not longer related to Maven itself but to the absence of some part / component. I open another post, in according with the forum rules. Thank all for your time. – Archimede Dec 13 '19 at 12:24

1 Answers1

-4

you can try this command with skip your unit test cases

"mvn clean install -DskipTests=true"

Sumit
  • 38
  • 3