简体   繁体   中英

Deploying maven build project on tomcat in eclipse

I have been trying to configure maven to one of the existing projects. I have performed these steps:

  1. Install m2e plugin for maven
  2. Add dependencies in the pom.xml : It only has dependencies - no plugins added
  3. No errors found
  4. Started Tomcat Server 7 - started successfully.
  5. Now when I try to add the project on the server -> ie I have run maven clean install and then the jar is created. I then go to the server and right click Add and Remove projects - > Nothing happens
  6. When trying to access the project link using //localhost:8080/projectName, I get the message "The requested resource is not available"

Can anyone please suggest what am i missing? Do i need any plugin for the tomcat server? Or any plugin to be added on my pom.xml?

Thanks a lot for the help

Adding the pom.xml below:

<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</groupId> 
<artifactId>abc</artifactId> 
<version>1.0</version> 
<packaging>jar</packaging> 
<name>ABC</name> 
<url>http://maven.apache.org</url> 

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId> 
        <artifactId>spring</artifactId> 
        <version>2.5.6</version> 
    </dependency>
</dependencies>
</project>
<packaging>jar</packaging> 

ie I have run maven clean install and then the jar is created. I then go to the server and right click Add and Remove projects

You should create a war, not a jar.

Take a look at this:

http://maven.apache.org/plugins/maven-war-plugin/usage.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM