mvn clean install -Dmaven.test.skip=true -Dmaven.compile.fork=true -Ptest
mvn clean install 删除重新编译
-Dmaven.test.skip=true 不执行测试用例,也不编译测试用例类(-DskipTests不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下)
-Dmaven.compile.fork=true 用以指明多线程进行编译
-Ptest P代表(Profiles配置文件),在指定的 中,可以通过-P进行传递或者赋值。
相关详情连接
@echo off
echo 1、执行打包脚本至UAT环境或release环境
mvn clean install -Dmaven.test.skip=true -Dmaven.compile.fork=true -Ptest
set CurrentDir=%cd%
set TargetFolder=target\
if not exist %CurrentDir%%TargetFolder% (
md %cd%\target
)
echo 2、复制打包后的文件至target文件夹
copy %currentDir%\打的jar包相对于项目的位置\target\trte-be-serce-0.0.1-SNAPSHOT.zip %TargetFolder%
copy %currentDir%\打的jar包相对于项目的位置\target\trte-or-serce-0.0.1-SNAPSHOT.zip %TargetFolder%
copy %currentDir%\打的war包相对于项目的位置\target\trte-web.war %TargetFolder%
pause
@echo off
echo 1、执行打包脚本至UAT环境或release环境
-- mvn clean install -Dmaven.test.skip=true -Dmaven.compile.fork=true -Ptest
set CurrentDir=%cd%
set TargetFolder=target\
if not exist %CurrentDir%%TargetFolder% (
md %cd%\target
)
echo 2、复制打包后的文件至target文件夹
copy %currentDir%\打的jar包相对于项目的位置\target\trte-be-serce-0.0.1-SNAPSHOT.zip %TargetFolder%
copy %currentDir%\打的jar包相对于项目的位置\target\trte-or-serce-0.0.1-SNAPSHOT.zip %TargetFolder%
copy %currentDir%\打的war包相对于项目的位置\target\trte-web.war %TargetFolder%
pause
<?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>com.itek.atp</groupId>
<artifactId>slate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>translate</name>
<profiles>
<profile>
<!-- 本地开发环境 -->
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
</profile>
<profile>
<!-- 发布环境 -->
<id>release</id>
<properties>
<profiles.active>release</profiles.active>
</properties>
</profile>
<profile>
<!-- 测试环境 -->
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
</properties>
<activation>
<!-- 设置默认激活这个配置 -->
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<!-- 演示环境 -->
<id>uat</id>
<properties>
<profiles.active>uat</profiles.active>
</properties>
</profile>
</profiles>
<modules>
<!-- module 顺序的改变会影响打包 -->
<module>trte-be</module>
<module>trte-or</module>
<module>trte-web </module>
</modules>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>central</name>
<url>http://10.40.204.239:8081/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>public</id>
<name>Public Repositories</name>
<url>http://10.40.204.239:8081/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>releases</id>
<name>Release</name>
<url>http://10.40.204.239:8081/nexus/content/repositories/releases/</url>
<uniqueVersion>true</uniqueVersion>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshot</name>
<url>http://10.40.204.239:8081/nexus/content/repositories/snapshots/</url>
<uniqueVersion>true</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.7</java.version>
<java-version>1.7</java-version>
<org.springframework.version>4.1.2.RELEASE</org.springframework.version>
<org.slf4j-version>1.7.9</org.slf4j-version>
<logback.version>1.1.3</logback.version>
<dubbo.version>2.8.4</dubbo.version>
<resteasy-version>3.0.14.Final</resteasy-version>
<sitemesh.version>2.4.2</sitemesh.version>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
</properties>
</project>
子pom内容:
<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>
<parent>
<artifactId>iflyframework</artifactId>
<groupId>com.iflytek</groupId>
<version>${project.version}</version>
</parent>
<artifactId>iflyframework-api</artifactId>
<description>dubbo service</description>
<!-- dubbo服务端相关jar包依赖 -->
<dependencies>
<!-- dubbo dependency -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>profiles/${profile.active}</directory>
<filtering>true</filtering>
<includes>
<include>*.properties</include>
</includes>
</resource>
<resource>
<targetPath>${project.build.directory}/classes</targetPath>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/**/*.xml</include>
<include>*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<classDirectory>target/classes</classDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.alibaba.dubbo.container.Main</mainClass>
<useUniqueVersions>false</useUniqueVersions>
</manifest>
<manifestEntries>
<Class-Path>.</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<phase>package</phase>
<configuration>
<type>jar</type>
<includeTypes>jar</includeTypes>
<useUniqueVersions>false</useUniqueVersions>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${project.build.sourceVersion}</source>
<target>${project.build.targetVersion}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>