Maven创建一个jar包

时间:2014-04-24 13:58:04

标签: maven jar apache-storm

当我运行此命令时:

mvn -e package 

我收到了这个错误:

[INFO] Error stacktraces are turned on. 
[DEBUG] Reading global settings from /usr/local/apache-maven-3.1.1/conf/settings.xml 
[DEBUG] Reading user settings from /root/.m2/settings.xml [DEBUG] Using local repository at /root/.m2/repository 
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /root/.m2/repository 
[INFO] Scanning for projects... 
[DEBUG] Extension realms for project org.apache.maven:standalone-pom:pom:1: (none) 
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null] 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.090s 
[INFO] Finished at: Thu Apr 24 11:47:01 CEST 2014 [INFO] Final Memory: 12M/362M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] The goal you specified requires a project to execute but there is no POM in 
this directory (/root/src/storm-starter). Please verify you invoked Maven from the 
correct directory. -> [Help 1] org.apache.maven.lifecycle.MissingProjectException: The 
goal you specified requires a project to execute but there is no POM in this directory 
(/root/src/storm-starter). Please verify you invoked Maven from the correct directory. 
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89) 
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) 
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) 
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) 
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:606) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
[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/MissingProjectException

1 个答案:

答案 0 :(得分:3)

Maven需要一个名为pom.xml的文件,该文件位于您拥有项目并正在执行maven的目录中。

这是默认值;如果您的评论pom.xml中描述了m2-pom.xml之类的其他文件,则必须通过-f标记通知maven。

mvn -f m2-pom.xml clean package