mvn package命令在mvn clean命令后不会成功运行,如果从命令提示符执行 [英] mvn package command doesn't run successfully after mvn clean command if done from command prompt

查看:2862
本文介绍了mvn package命令在mvn clean命令后不会成功运行,如果从命令提示符执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
当我在执行mvn clean命令之后从命令行运行mvn package命令时遇到一个奇怪的错误。
错误是编译失败错误。

Hi I get a weird error when I run mvn package command from the command line after executing mvn clean command. The error is a compilation failure error.

这是一个跟踪:

annotations are not supported in -source 1.3
06.04.2011 17.06.59 (use -source 5 or higher to enable annotations)
06.04.2011 17.06.59 @Override at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715)
06.04.2011 17.06.59 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
06.04.2011 17.06.59 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
06.04.2011 17.06.59 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
06.04.2011 17.06.59 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
06.04.2011 17.06.59 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
06.04.2011 17.06.59 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
06.04.2011 17.06.59 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
06.04.2011 17.06.59 at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
06.04.2011 17.06.59 at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
06.04.2011 17.06.59 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06.04.2011 17.06.59 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
06.04.2011 17.06.59 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
06.04.2011 17.06.59 at java.lang.reflect.Method.invoke(Method.java:597)
06.04.2011 17.06.59 at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
06.04.2011 17.06.59 at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
06.04.2011 17.06.59 at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
06.04.2011 17.06.59 at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
06.04.2011 17.06.59 Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
06.04.2011 17.06.59 at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
06.04.2011 17.06.59 at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
06.04.2011 17.06.59 at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
06.04.2011 17.06.59 at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)

奇怪的是,当我运行mvn package命令从eclipse IDE / m2eclipse它工作完美(即使从IDE和命令提示符运行mvn清除后)。当我从命令提示符运行mvn软件包命令与之前的mvn软件包命令已经内置在目标文件夹中的WAR文件命令工作正常,战争文件被创建,并覆盖以前创建的战争文件在目标文件夹中。但是当我从IDE /命令提示符下运行mvn clean,然后从命令提示符运行mvn package,它给我上面的错误,编译失败。
我想自动化这个构建过程,所以我需要从命令行完成这个。

The strange thing is when I run mvn package command from eclipse IDE /m2eclipse it works perfectly fine (Even after running mvn clean from IDE as well as command prompt). when I run mvn package command from command prompt with the WAR file already built in the target folder by previous mvn package command the command works fine and a war file gets created and gets overwritten on the previously created war file in the target folder. But when I run mvn clean from IDE/Command prompt and then run mvn package from command prompt it gives me the above error and the compilation fails. I want to automate this build process so I need to get this done from command line.

推荐答案

Eclipse maven插件还安装了另一个Maven(core)的副本。因此,在通过eclipse VS命令行运行maven命令时,很少的东西会工作不同。为了摆脱这种情况配置你的eclipse使用maven安装你期望它使用。窗口 - >首选项 - > Maven - >安装,并将设置更改为指向您下载的本地副本。

Eclipse maven plugin also installs another copy of Maven (core). So, few of things would work differently while running maven command through eclipse VS Command line. To get away from this situation configure your eclipse to use maven installation you're expecting it to use. Window --> Preferences --> Maven--> Installations and change the setting to point to the local copy you've downloaded.

这篇关于mvn package命令在mvn clean命令后不会成功运行,如果从命令提示符执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆