启动maven服务时 出现No goals have been specified for this build. You must specify a valid lifecycle phase o

Posted ぃSolitary_boy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了启动maven服务时 出现No goals have been specified for this build. You must specify a valid lifecycle phase o相关的知识,希望对你有一定的参考价值。

异常:

No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize,

原因:在pom.xm文件中配置tomcat插件时编译出现了问题

解决方法:在pom.xml文件中找到<build>标签,在里面加 上<defaultGoal>compile</defaultGoal>,代码如下:

<build>
  <defaultGoal>compile</defaultGoal>
	 <plugins>
	  <!-- 配置Tomcat插件 -->
	  <plugin>
	    <groupId>org.apache.tomcat.maven</groupId>
	    <artifactId>tomcat7-maven-plugin</artifactId>
		  <configuration>
			<path>/</path>
			<port>8080</port>
		  </configuration>
	  </plugin>
	</plugins>
 </build>

  

 

以上是关于启动maven服务时 出现No goals have been specified for this build. You must specify a valid lifecycle phase o的主要内容,如果未能解决你的问题,请参考以下文章

Maven :No goals have been specified for this build

运行Maven是报错:No goals have been specified for this build

运行Maven工程总是报错:No goals have been specified for this build

No goals have been specified for this build. You

Maven报错 解决方案。ERROR: No goals have been specified for this build. You must specify a valid lifecycle(

Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean