0

我在配置 Jenkins 时遇到问题,我正在从 tomcat7 [在 ubuntu 上] [从 apache 下载,未通过 apt-get 安装] 运行 jenkins。我已经从 Oracle 安装了 java。当我想构建一个项目时,maven 说 maven-compiler-plugin 导致问题:

    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project npa: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    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:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)

关键是我没有在这个版本中使用 maven-compiler-plugin,我什至没有在任何 POM 中声明这个插件!我自己不能在 pom 中添加任何东西[不要问为什么]

编辑:全栈 [ maven 中的 -X 选项]

14:02:37    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
14:02:37    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
14:02:37    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
14:02:37    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
14:02:37    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
14:02:37    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
14:02:37    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
14:02:37    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
14:02:37    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
14:02:37    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
14:02:37    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14:02:37    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
14:02:37    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
14:02:37    at java.lang.reflect.Method.invoke(Method.java:597)
14:02:37    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
14:02:37    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
14:02:37    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
14:02:37    at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)
14:02:37    at hudson.maven.Maven3Builder.call(Maven3Builder.java:64)
14:02:37    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
14:02:37    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
14:02:37    at hudson.remoting.Request$2.run(Request.java:326)
14:02:37    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
14:02:37    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
14:02:37    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
14:02:37    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
14:02:37    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
14:02:37    at java.lang.Thread.run(Thread.java:662)
14:02:37 Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
14:02:37    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
14:02:37    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
14:02:37    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
14:02:37    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
4

1 回答 1

1

代码无法编译。Maven 默认包含编译器插件。查看错误消息的其余部分以找出代码未编译的原因。可能与不兼容的 Java 版本有关。

编辑:您正在使用默认为 Java 1.3 选项的旧版本的编译器插件,这就是它无法编译的原因。

我怀疑 Jenkins 可能指向 Maven 2(请参阅这个问题Maven : error: generics are not supported in -source 1.3 ,我正在使用 1.6)。确保 Jenkins 使用正确的 Maven 3 安装。

于 2013-04-02T11:54:22.223 回答