• 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>

  • 相关阅读:
    Ajax技术应用方面
    关于tomcat环境配置的疑惑(tomcat未进行任何环境配置仍成功显示welcome页面)
    jsp中动态include与静态include的区别
    简单说说tomcat7.0的配置
    传统开发模式与Ajax开发模式的区别
    认识Ajax
    tomcat与jdk的关系
    org.hibernate.TransactionException: nested transactions not supported
    解读Tomcat7.0的startup.bat批处理命令
    forward和redirect的区别
  • 原文地址:https://www.cnblogs.com/YuyuanNo1/p/7837833.html
Copyright © 2020-2023  润新知