zoukankan      html  css  js  c++  java
  • maven指定项目的构建、打包和tomcat插件的pom.xml配置

    1、pom.xml添加如下配置:

    <build>
    <finalName>${parent.artifactId}</finalName>
    <plugins>
    <plugin>
    <artifactId>maven-deploy-plugin</artifactId>
    <configuration>
    <skip>true</skip>
    </configuration>
    </plugin>
    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
    <uriEncoding>UT-8</uriEncoding>
    <port>8088</port>
    <path>/</path>
    </configuration>

    </plugin>

    <!-- 打包插件, 便于部署 -->
    <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.5.5</version>
    <configuration>
    <descriptors>
    <!-- 指定描述文件 -->
    <descriptor>../assembly.xml</descriptor>
    </descriptors>
    <!-- 输出文件一定要放到项目根目录的target 目录下,
    当前此插件在web子模块执行,其parent 才是项目根目录 -->
    <outputDirectory>${project.parent.build.directory}</outputDirectory>
    </configuration>
    <executions>
    <execution>
    <id>packaging</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>


    2、
    assembly.xml如下:
    <?xml version="1.0" encoding="UTF-8"?>
    <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

    <!-- 与maven assembly plugin 配合使用 -->

    <id>assembly</id>
    <!-- 使用项目名称 -->
    <baseDirectory>/</baseDirectory>
    <formats>
    <!-- 压缩格式 -->
    <format>tar.gz</format>
    </formats>
    <fileSets>
    <fileSet>
    <!-- web 项目 直接指定 打包目录
    需要在web 模块的 pom 指定 finalName 为 项目名称
    -->
    <directory>target/${project.build.finalName}</directory>
    <outputDirectory>/</outputDirectory>
    </fileSet>
    </fileSets>

    </assembly>

  • 相关阅读:
    linux时间格式化
    mysql5.7 安装版安装
    mac下面安装多个JDK
    linux一台机器文件传到另一台机器上
    取模运算
    【UVALive 7334】Kernel Knights
    【HDU 2604】Queuing
    【CodeForces 577B】Modulo Sum
    【CodeForces 504A】Misha and Forest
    【HDU 2203】亲和串
  • 原文地址:https://www.cnblogs.com/YuyuanNo1/p/7837833.html
Copyright © 2011-2022 走看看