Java 未知的生命周期阶段“构建”。您必须以以下格式指定有效的生命周期阶段或目标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36552133/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 18:24:40  来源:igfitidea点击:

Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format

javamaven

提问by Gringo Golf

Team,

团队,

Getting the following error on my pom file. Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format. I went thru the URL provided but still getting the error. MVN version 3.2.1,Java version: 1.7.0_51 any help would be appreciated

在我的 pom 文件中出现以下错误。未知的生命周期阶段“构建”。您必须在格式中指定有效的生命周期阶段或目标。我浏览了提供的 URL,但仍然收到错误消息。MVN 版本 3.2.1,Java 版本:1.7.0_51 任何帮助将不胜感激

POM looks like:

POM 看起来像:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.organization.dramer</groupId>
<artifactId>sTest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sTest</name>
<description>test automation framework created using Java, testNG,
selenium</description>


  <properties>
  <suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>
  <skipTests>false</skipTests>
  </properties>

  <dependencies>
    <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>3.2</version>
        <scope>provided</scope>
    </dependency>

  <dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>6.8</version>
  <scope>test</scope>
  </dependency>

  <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.53.0</version>
    </dependency>

    <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>2.44.0</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>htmlunit-driver</artifactId>
        <version>2.20</version>
    </dependency>  

    <dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6.12</version>
    </dependency>

      </dependencies>

  <build>

  <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
        </configuration>
    </plugin>

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.6</version>
        <configuration>
            <suiteXmlFiles>
                <suiteXmlFile>${suiteXmlFile)</suiteXmlFile>
            </suiteXmlFiles>    
            <testFailureIgnore>true</testFailureIgnore>
        </configuration>
    </plugin>
  </plugins>




  </build>




</project>

回答by Esko

Maven doesn't have buildtarget (phasein Maven lingo), what you probably want is either compile, testor installdepending what you want to achieve.

Maven 没有build目标(Maven 术语中的阶段),您可能想要的是compiletest或者install取决于您想要实现的目标。

Please read through Introduction to the Build Lifecycleto learn more about how Maven lifecycle works and what each step does.

请通读构建生命周期简介以了解有关 Maven 生命周期如何工作以及每个步骤的作用的更多信息。