尝试使用Maven编译谷歌编译器时出错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了尝试使用Maven编译谷歌编译器时出错相关的知识,希望对你有一定的参考价值。
我正在按照此处的说明尝试编译闭包编译器:
https://github.com/google/closure-compiler
javac -version
javac 1.8.0_232
mvn --version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_232, vendor: Private Build
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1062.7.1.el7.x86_64", arch: "amd64", family: "unix"
执行时:mvn -DskipTests -pl externs / pom.xml,pom-main.xml,pom-main-shaded.xml
.
.
.
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ closure-compiler ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 763 source files to /workspace/closure-compiler/target/classes
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] /workspace/closure-compiler/src/com/google/javascript/jscomp/ant/AntErrorManager.java:[19,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/refactoring/FixingErrorManager.java:[30,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/jscomp/deps/JsFileFullParser.java:[27,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/jscomp/ant/AntErrorManager.java:[19,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/refactoring/FixingErrorManager.java:[30,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/jscomp/deps/JsFileFullParser.java:[27,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/jscomp/ant/AntErrorManager.java:[19,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/refactoring/FixingErrorManager.java:[30,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[WARNING] /workspace/closure-compiler/src/com/google/javascript/jscomp/deps/JsFileFullParser.java:[27,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[INFO] 9 warnings
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Closure Compiler Externs ........................... SUCCESS [ 2.195 s]
[INFO] Closure Compiler Main .............................. SUCCESS [ 1.312 s]
[INFO] Closure Compiler ................................... FAILURE [ 33.755 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 39.156 s
[INFO] Finished at: 2020-01-09T16:51:45+00:00
[INFO] Final Memory: 18M/61M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project closure-compiler: Compilation failure: Compilation failure:
[ERROR] /workspace/closure-compiler/src/com/google/javascript/jscomp/ant/AntErrorManager.java:[19,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/refactoring/FixingErrorManager.java:[30,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/jscomp/deps/JsFileFullParser.java:[27,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/jscomp/ant/AntErrorManager.java:[19,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/refactoring/FixingErrorManager.java:[30,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/jscomp/deps/JsFileFullParser.java:[27,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/jscomp/ant/AntErrorManager.java:[19,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/refactoring/FixingErrorManager.java:[30,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[ERROR] /workspace/closure-compiler/src/com/google/javascript/jscomp/deps/JsFileFullParser.java:[27,35] [deprecation] BasicErrorManager in com.google.javascript.jscomp has been deprecated
[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 <goals> -rf :closure-compiler
这在Ubuntu 16.04.2 LTS上发生,但是我在centos 7上遇到了相同的问题。
有人可以解释发生了什么吗?
更新:
我修改了pom.xml并删除了弃用项
<compilerArgument>-Xlint:unchecked,deprecation,fallthrough,finally</compilerArgument>
现在构建失败并显示:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project closure-compiler: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project closure-compiler: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
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 sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
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)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1224)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
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 sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
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:4
06)在org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)]
答案
不知道这是否是相同的问题,但是我在Ubuntu 18.04上有类似之处。原来我只安装了JRE,而没有安装JDK。运行sudo apt install openjdk-8-jdk
后,便可以编译,没问题。
以上是关于尝试使用Maven编译谷歌编译器时出错的主要内容,如果未能解决你的问题,请参考以下文章