码迷,mamicode.com
首页 > 其他好文 > 详细

maven package

时间:2017-06-15 14:26:44      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:his   rect   ror   env   als   rip   war   set   esc   

Shell Script

 

#!/bin/bash
#-----------------------------------------------
# FileName: pack.sh
# Reversion: 1.2
# Date: 2017/06/15
# Author: zhengwenqiang
# Email: gloryzheng@126.com.cn
# Description: mvn package with specialized maven profile.
# Notes: 
# Execute this script with GNU environment which cound be initialized through installation of mingw on windows.
# Copyright: 2017(c) zhengwenqiang
# License: GPL
#-----------------------------------------------

if [ -n $M2_HOME -o -n $MAVEN_HOME ] ; then
# delete target directory.
    [ -d target ] && mvn clean
# package war file with profile which id is deploy
    [ $? -eq 0 ] && mvn package -Pdeploy
elif [ -z $M2_HOME -a -z $MAVEN_HOME ] ; then
    echo "could not exec mvn cmd, error!"
fi 

pom.xml

<profiles>
    <profile>
    <!-- 批量部署 -->
    <id>deploy</id>
    <properties>
    <finalName>warName</finalName>
    </properties>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <configuration>
                            <target>
                                <copy todir="${basedir}/target/classes/" overwrite="true">
                                <fileset dir="${basedir}/release/deploy/resources/"/>
                                </copy>
                                <copy todir="${basedir}/src/webapp/WEB-INF/" overwrite="true">
                                <fileset dir="${basedir}/release/deploy/WEB-INF/"/>
                                </copy>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    </profile>
</profiles>

Project Structure

技术分享

 

maven package

标签:his   rect   ror   env   als   rip   war   set   esc   

原文地址:http://www.cnblogs.com/cpuz/p/7017037.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!