zoukankan      html  css  js  c++  java
  • maven打包

    https://blog.csdn.net/zhaojianting/article/details/80321488

    https://blog.csdn.net/zhaojianting/article/details/80324533

    install 是发布到仓库和私服仓库  清理 编译 测试 打包

    <?xml version="1.0" encoding="UTF-8"?>
    <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>cn.com.yitong</groupId>
    <artifactId>ares-mmc</artifactId>
    <version>2.0.1</version>
    <description>营销管理平台</description>
    <name>ares-mmc</name>
    <packaging>war</packaging>
    <url>http://maven.apache.org</url>
    <properties>
    <!-- ares框架版本 -->
    <ares.version>5.1.18</ares.version>
    <!-- 项目编译字符集 -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!-- jdk编译版本 -->
    <jdk.version>1.8</jdk.version>
    <dubbo.version>2.8.4</dubbo.version>
    <!-- maven tomcat7插件版本 -->
    <maven-tomcat-plugin.version>2.0</maven-tomcat-plugin.version>
    <!-- maven编译插件版本 -->
    <maven-compiler-plugin.version>2.5.1</maven-compiler-plugin.version>
    <!-- 源码打包插件 -->
    <maven-source-plugin.version>2.4</maven-source-plugin.version>
    <!-- maven打war插件版本号 -->
    <maven-war-plugin.version>2.6</maven-war-plugin.version>
    <poi.version>3.15</poi.version>
    <junit.version>4.12</junit.version>
    <surk_version>1.0.0.20181018-SNAPSHOT</surk_version>
    </properties>
    <dependencies>
    <dependency>
    <groupId>cn.com.yitong</groupId>
    <artifactId>ares-web-core</artifactId>
    <version>${ares.version}</version>
    </dependency>
    <dependency>
    <groupId>cn.com.yitong</groupId>
    <artifactId>ares-logger-log4j2</artifactId>
    <version>${ares.version}</version>
    </dependency>
    <dependency>
    <groupId>cn.com.yitong</groupId>
    <artifactId>ares-action-atom</artifactId>
    <version>${ares.version}</version>
    </dependency>
    <dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-mapper-asl</artifactId>
    <version>1.9.12</version>
    </dependency>
    <!-- 测试环境添加如下jar,去掉jerry -->
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    </dependency>
    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
    </dependency>
    <!-- 添加jetty容器,去掉上面的javax.servlet相关的jar -->
    <dependency>
    <groupId>cn.com.yitong</groupId>
    <artifactId>ares-web-jetty</artifactId>
    <version>${ares.version}</version>
    </dependency>
    <!-- 数据库驱动 -->
    <dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ojdbc14-10.2.0.4.0.jar</systemPath>
    </dependency>
    <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.19</version>
    </dependency>
    <!-- fasterxml -->
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.6.5</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.6.5</version>
    </dependency>
    <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.6.5</version>
    </dependency>
    <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.1.2</version>
    </dependency>
    <dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.1.2</version>
    </dependency>
    <dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.1</version>
    </dependency>
    <!-- poi office -->
    <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>${poi.version}</version>
    </dependency>
    <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>${poi.version}</version>
    </dependency>
    <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml-schemas</artifactId>
    <version>${poi.version}</version>
    </dependency>
    <!-- disruptor -->
    <dependency>
    <groupId>com.lmax</groupId>
    <artifactId>disruptor</artifactId>
    <version>3.3.2</version>
    </dependency>
    <!-- 测试依赖包 start -->
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>${junit.version}</version>
    <scope>test</scope>
    </dependency>

    <dependency>
    <groupId>com.xiongyingqi</groupId>
    <artifactId>qrcode</artifactId>
    <version>0.1.5</version>
    </dependency>

    <!-- dubbo -->
    <dependency>
    <groupId>cn.com.yitong.ares</groupId>
    <artifactId>ares-cloud-service-api</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ares-cloud-service-api-1.0.0-SNAPSHOT.jar</systemPath>
    </dependency>
    <dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>dubbo</artifactId>
    <version>${dubbo.version}</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/dubbo-2.8.4.jar</systemPath>
    </dependency>
    <dependency>
    <groupId>cn.com.yitong</groupId>
    <artifactId>ares-dubbo-api</artifactId>
    <version>1.3.3</version>
    <scope>system</scope>
    <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ares-dubbo-api-1.3.3.jar</systemPath>
    <exclusions>
    <exclusion>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    <dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.1.39</version>
    </dependency>
    <dependency>
    <groupId>org.apache.zookeeper</groupId>
    <artifactId>zookeeper</artifactId>
    <version>3.4.8</version>
    <exclusions>
    <exclusion>
    <artifactId>jmxtools</artifactId>
    <groupId>com.sun.jdmk</groupId>
    </exclusion>
    <exclusion>
    <artifactId>jmxri</artifactId>
    <groupId>com.sun.jmx</groupId>
    </exclusion>
    <exclusion>
    <artifactId>jms</artifactId>
    <groupId>javax.jms</groupId>
    </exclusion>
    <exclusion>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    </exclusion>
    <exclusion>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    <dependency>
    <groupId>org.javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.20.0-GA</version>
    </dependency>
    <dependency>
    <groupId>com.github.sgroschupf</groupId>
    <artifactId>zkclient</artifactId>
    <version>0.1</version>
    <exclusions>
    <exclusion>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    </exclusion>
    </exclusions>
    </dependency>
    <dependency>
    <groupId>de.javakaffee</groupId>
    <artifactId>kryo-serializers</artifactId>
    <version>0.26</version>
    </dependency>
    <dependency>
    <groupId>de.ruedigermoeller</groupId>
    <artifactId>fst</artifactId>
    <version>1.55</version>
    </dependency>
    <dependency>
    <groupId>com.wdph</groupId>
    <artifactId>wdph-job-core</artifactId>
    <version>2.1.1-SNAPSHOT</version>
    </dependency>
    <dependency>
    <groupId>com.wandaph</groupId>
    <artifactId>wandaph-surk-client</artifactId>
    <version>${surk_version}</version>
    </dependency>
    </dependencies>
    <profiles>
    <!-- DEV集成测试环境,默认激活 -->
    <profile>
    <id>dev</id>
    <properties>
    <profiles.active>dev</profiles.active>
    <env>env/DEV</env>
    </properties>
    <activation>
    <activeByDefault>true</activeByDefault>
    </activation>
    </profile>
    <!-- UAT验收测试环境 -->
    <profile>
    <id>uat</id>
    <properties>
    <profiles.active>uat</profiles.active>
    <env>env/UAT</env>
    </properties>
    </profile>
    <!-- SIT验收测试环境 -->
    <profile>
    <id>test</id>
    <properties>
    <profiles.active>test</profiles.active>
    <env>env/TEST</env>
    </properties>
    </profile>
    <!-- 上海性能测试环境 -->
    <profile>
    <id>shpfm</id>
    <properties>
    <profiles.active>shpfm</profiles.active>
    <env>env/SHPFM</env>
    </properties>
    </profile>
    <!-- 上海性能测试环境 -->
    <profile>
    <id>pfm</id>
    <properties>
    <profiles.active>pfm</profiles.active>
    <env>env/PFM</env>
    </properties>
    </profile>
    <!-- 生产环境 -->
    <profile>
    <id>pro</id>
    <properties>
    <profiles.active>pro</profiles.active>
    <env>env/PRO</env>
    </properties>
    </profile>
    </profiles>
    <build>
    <finalName>mkt-admin</finalName>
    <plugins>
    <!-- tomcat7插件 -->
    <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>${maven-tomcat-plugin.version}</version>
    <configuration>
    <port>8080</port>
    </configuration>
    </plugin>
    <plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.8.v20171121</version>
    </plugin>
    <!-- 多个源码目录配置 -->
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
    <execution>
    <id>add-source</id>
    <phase>generate-sources</phase>
    <goals>
    <goal>add-source</goal>
    </goals>
    <configuration>
    <sources>
    <source>${basedir}/src/main/java</source>
    <!-- 我们可以通过在这里添加多个source节点,来添加任意多个源文件夹 -->
    </sources>
    </configuration>
    </execution>
    </executions>
    </plugin>
    <!-- 打war包插件 -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>${maven-war-plugin.version}</version>
    </plugin>
    <!-- 编译插件 -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
    <configuration>
    <source>${jdk.version}</source>
    <target>${jdk.version}</target>
    <encoding>${project.build.sourceEncoding}</encoding>
    </configuration>
    </plugin>
    <!-- 源码打包插件 -->
    <!-- <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <version>${maven-source-plugin.version}</version>
    <executions>
    <execution>
    <phase>package</phase>
    <goals>
    <goal>jar-no-fork</goal>
    </goals>
    </execution>
    </executions>
    </plugin> -->
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.6</version>
    <!-- <dependencies> <dependency> <groupId>cn.com.yitong</groupId> <artifactId>ares-packer</artifactId>
    <version>${ares.version}</version> </dependency> </dependencies> -->
    <configuration>
    <appendAssemblyId>false</appendAssemblyId>
    <descriptors>
    <descriptor>src/main/assembly/${env}/assembly.xml</descriptor>
    </descriptors>
    </configuration>
    <executions>
    <execution>
    <id>make-assembly</id>
    <phase>package</phase>
    <goals>
    <goal>single</goal>
    </goals>
    <!-- <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptorRefs>
    <descriptorRef>assembly</descriptorRef> </descriptorRefs> </configuration> -->
    </execution>
    </executions>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
    <execution>
    <id>copy-war</id>
    <phase>package</phase>
    <goals>
    <goal>copy</goal>
    </goals>
    <configuration>
    <artifactItems>
    <artifactItem>
    <groupId>${project.groupId}</groupId>
    <artifactId>${project.artifactId}</artifactId>
    <version>${project.version}</version>
    <type>${project.packaging}</type>
    <destFileName>mkt-admin-${profiles.active}.war</destFileName>
    </artifactItem>
    </artifactItems>
    <outputDirectory>../ares-mmc/playbook/roles/task/files/</outputDirectory>
    </configuration>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>

    </project>

    <assembly>
    <id>dev</id>
    <formats>
    <format>war</format>
    <format>dir</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
    <!-- 将项目依赖的JAR包输出到 WEB-INF/lib -->
    <dependencySet>
    <outputDirectory>WEB-INF/lib</outputDirectory>
    <useProjectArtifact>false</useProjectArtifact>
    </dependencySet>
    </dependencySets>
    <fileSets>
    <!-- 专属的差异配置 -->
    <fileSet>
    <directory>src/main/assembly/env/DEV/conf</directory>
    <outputDirectory>WEB-INF/classes</outputDirectory>
    <fileMode>0644</fileMode>
    </fileSet>
    <!-- 所有的配置 -->
    <fileSet>
    <directory>${project.build.outputDirectory}</directory>
    <outputDirectory>WEB-INF/classes</outputDirectory>
    </fileSet>
    <!-- 将 webapp 下的文件输出到 WAR 包 -->
    <fileSet>
    <directory>${project.basedir}/src/main/webapp</directory>
    <outputDirectory>/</outputDirectory>
    </fileSet>
    </fileSets>
    </assembly>

  • 相关阅读:
    日志框架 log4j2 全解析
    SpringMVC开发RESTful接口
    SpringMVC 进阶
    SpringMVC 参数映射与文件上传
    SSM整合
    算法分析
    SpringMVC 入门
    数据结构与算法概念
    在普通WEB项目中使用Spring
    《算法导论》——重复元素的随机化快排Optimization For RandomizedQuickSort
  • 原文地址:https://www.cnblogs.com/jishumonkey/p/12710529.html
Copyright © 2011-2022 走看看