我正在为我的Maven Springboot项目做一个mvn clean
软件包,但是我看到以下消息。可能是什么原因?我已经在互联网上搜索了任何内容;是一种常见情况,但没有人提供对我有用的确定性解决方案。
我的mvn版本是3.6.3;我尝试从命令行执行此操作;我的是Linux Mint Cinnamnon的最新版本;我的Java是OpendJDK 11.0.5; Maven编译器插件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)
这是输出的前一部分
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] ------------------------------------------------------------------------
---------------------------------------------------
如果我尝试在我的主pom.xml中添加javaccompilerforce用法,以使该部分如下所示
<version>3.8.0</version>
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
这次我看到了这个新错误
[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
真的,是没有一个文件夹或软件包的问题的原因吗?还是第二行仅与javaccompilerforce选项本身相关,而与应用程序的核心无关?看来我太陌生或平庸。此外,完全相同的应用程序可以在另一台计算机上完美运行。
我想感谢您所有的时间,问题在于缺少某些组件。我试图添加这些,现在错误消息已更改。在这一点上,我有点麻烦,因为我看到了以下Maven输出:
[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
因此,我在该文件中搜索了8行,发现了这一行
import org.springframework.web.bind.annotation.ExceptionHandler;
但是,引用InvalidPropertyValueException的行在前面两行:
import com.mycompany.myapp.exception.InvalidPropertyValueException;
而且,奇怪的是,在com.mycompanny.myapp.exception包中,我没有找到任何名为InvalidPropertyValueException的类或文件。但是Eclipse接受它并在选项列表中显示我。而且此类不会产生任何错误或红线。
答案 0 :(得分:0)
您可以在跳过单元测试用例的情况下尝试使用此命令
“ mvn全新安装-DskipTests = true ”
答案 1 :(得分:0)
我也有这个问题,我正在使用Eclipse STS,并且正在使用AdoptOpenJdk 11.0.6.10和maven 3.6.3和maven-compiler-plugin 3.8.1构建项目。