问题描述
1,初学maven,环境变量都已经配置好了,而且运行mvn-version都没有问题2,在cmd下运行mvn出现Nogoalshavebeenspecifiedforthisbuild.已经困扰我几天了,这个问题没法让我继续往下学了,特在此求助前辈同仁们。C:DocumentsandSettingszhouyu>mvn[INFO]Scanningforprojects...[INFO]------------------------------------------------------------------------[INFO]BUILDFAILURE[INFO]------------------------------------------------------------------------[INFO]Totaltime:0.343s[INFO]Finishedat:SunNov1310:35:13CST2011[INFO]FinalMemory:1M/4M[INFO]------------------------------------------------------------------------[ERROR]Nogoalshavebeenspecifiedforthisbuild.Youmustspecifyavalidlifecyclephaseoragoalintheformat<plugin-prefix>:<goal>or<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.Availablelifecyclephasesare:validate,initialize,generate-sources,process-sources,generate-resources,process-resources,compile,process-classes,generate-test-sources,process-test-sources,generate-test-resources,process-test-resources,test-compile,process-test-classes,test,prepare-package,package,pre-integration-test,integration-test,post-integration-test,verify,install,deploy,pre-clean,clean,post-clean,pre-site,site,post-site,site-deploy.->[Help1][ERROR][ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch.[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging.[ERROR][ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles:[ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
解决方案
解决方案二:
帮你顶一下吧,没听过这个东东,不知道是做什么用的
解决方案三:
谢谢你关注此贴,maven构建标准项目结构
解决方案四:
Nogoalshavebeenspecifiedforthisbuild.Youmustspecifyavalidlifecyclephaseoragoalintheformat<plugin-prefix>:<goal>or<plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>.Availablelifecyclephasesare:validate,initialize,generate-sources,process-sources,generate-resources,process-resources,compile,process-classes,generate-test-sources,process-test-sources,generate-test-resources,process-test-resources,test-compile,process-test-classes,test,prepare-package,package,pre-integration-test,integration-test,post-integration-test,verify,install,deploy,pre-clean,clean,post-clean,pre-site,site,post-site,site-deploy.这段讲得很清楚啊
解决方案五:
引用
在pom.xml文件<build>标签后面加上<defaultGoal>compile</defaultGoal>即可。其实使用命令行时就已经指定了phase,而使用m2eclipse的【RunAs】-【Mavenbuild】时并未为其指定goal或phase,所以才报这个错误。
去看看这几个原因应该有一个是你的错误:
解决方案六:
我也遇到这个问题,但是我是在自己新建的原型上建项目才会遇到这个问题