用maven打包java项目的pom文件配置

时间:2024-10-15 22:04:20

<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.ehouse</groupId>
  <artifactId>maven20170320_2</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>maven20170320_2 Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <!--只在编译时和测试时运行-->
    <scope>provided</scope>
</dependency>

</dependencies>
  <build>
    <finalName>maven20170320_2</finalName>
    <plugins>
        <plugin>
<!--          <groupId>org.eclipse.jetty</groupId> -->
<!--     <artifactId>jetty-maven-plugin</artifactId> -->
<!--     <version>9.4.2.v20170220</version> -->
     <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.2</version>
    <executions>
    <execution>
    <phase>package</phase>
    <goals>
    <!-- 打包成功后使用jetty run来运行jetty服务 -->
    <goal>run</goal>
    </goals>
    </execution>
        
    </executions>
        </plugin>
    </plugins>
  </build>
</project>