Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Tomcat with Maven and Eclipse - Unknown lifecycle phase

I am using Eclipse Helios,Tomcat Server 7. I have build my project using Maven. When I try to build my project, I get the below error in Eclipse.

 [INFO] Scanning for projects...
 [INFO]                                                                         
 [INFO] ------------------------------------------------------------------------
 [INFO] Building encore Maven Webapp 0.0.1-SNAPSHOT
 [INFO] ------------------------------------------------------------------------
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD FAILURE
 [INFO] ------------------------------------------------------------------------
 [INFO] Total time: 0.095s
 [INFO] Finished at: Tue Nov 06 18:17:55 IST 2012
 [INFO] Final Memory: 2M/36M
 [INFO] ------------------------------------------------------------------------
 [ERROR] Unknown lifecycle phase "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, 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. -> [Help 1]
 [ERROR] 
 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
 [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/LifecyclePhaseNotFoundException

Please let me know what is wrong in my code and kindly point to right directions. I need to figure it out ASAP.

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.encore</groupId>
<artifactId>encore</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>encore Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
   </dependency>
   <dependency>
    <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <version>1.1</version>      
</dependency>
 <dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-eclipse-plugin</artifactId>
  <version>2.9</version>     
</dependency>
</dependencies>

<build>
<finalName>encore</finalName>   
<plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
         <version>2.9</version>  
        <configuration>
                 <server>mytomcatserver</server>
                 <path>/encore</path>
                 <url>http://localhost:8080</url>
                 <username>admin</username>
                 <password>admin</password>
        </configuration>
    </plugin>
</plugins>
</build>
 </project>

This is my pom.xml. I am trying to Run my application as Run as-> mvn build from eclipse.

like image 559
Antony Avatar asked Nov 06 '12 13:11

Antony


1 Answers

It sounds like you've accidentally set the wrong goal when trying to build from Eclipse. Edit your Maven "Run as.." settings like so:

enter image description here

Note the clean install which will run the Maven commands to clean your build and do a full build and install into the local repository.

like image 59
Duncan Jones Avatar answered Oct 12 '22 13:10

Duncan Jones