2016-09-23 201 views
1

我得到了NullPointerException與maven-compiler-plugin:3.1。我已經調查了特種部隊的類似問題,但徒勞無功。maven-compiler-plugin:3.1:編譯失敗。 NullPointerException

我跑命令:mvn compile

Maven的環境

Apache Maven 3.0.3 (rNON-CANONICAL_2011-12-28_13-22_mein; 2011-12-28 13:22:36-0600) 
Maven home: /soft/maven/3.0.3 
Java version: 1.6.0_38, vendor: Sun Microsystems Inc. 
Java home: /soft/jdk1.6.0_38-arch/jre 
Default locale: en_US, platform encoding: UTF-8 
OS name: "linux", version: "3.13.0-83-generic", arch: "amd64", family: "unix" 

(因爲這是由該項目,舊項目所需它使用1.6) 錯誤消息

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wikibrain-utils: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile failed. NullPointerException -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wikibrain-utils: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile failed. 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile failed. 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    ... 19 more 
Caused by: java.lang.NullPointerException 
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.hasNewFile(AbstractCompilerMojo.java:1198) 
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.isDependencyChanged(AbstractCompilerMojo.java:1166) 
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:648) 
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    ... 20 more 
[ERROR] 
[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/PluginExecutionException 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 
[ERROR] mvn <goals> -rf :wikibrain-utils 
+1

3.1是相當古老。使用最新的3.5.1,並嘗試發佈問題的[mcve]。 – Tunaki

+1

不要使用Maven 3.0.3,它的確很奇怪。使用像3.3.9這樣更新的版本... – khmarbaise

回答

0

我已經解決了這個問題 - 它恰好是一個文件權限問題。

艾倫