首页 > 其他分享 >maven deploy configuration

maven deploy configuration

时间:2023-04-28 18:32:13浏览次数:41  
标签:TMP ENVIRONMENT deploy COMPONENT maven VERSION configuration ROOT DIR


in pom.xml, the config will be below:


<repositories>
		<repository>
			<id>com.nomura.xxx</id>
			<url>http://XXXXXXX:8080/archiva/repository</url>
		</repository>
	</repositories>



	
	<distributionManagement>
		<repository>
			<id>XXXX.release</id>
			<name>xxxxRelease Repository</name>
			<url>http://XXXXX/archiva/repository/release/</url>
		</repository>
		<snapshotRepository>
			<id>XXXXX.snapshot</id>
			<name>Internal Snapshot Repository</name>
			<url>http://XXXXX/archiva/repository/snapshot/</url>
		</snapshotRepository>
	</distributionManagement>


 

In the app workspace, you can input the command:

mvn deploy

 

to deploy the app into the share server.

 

And in the server that run the app, you can run below script to get app package.
deploy APPNAME VERSION

 

the scripts content will be :

 

#!/bin/bash

set -e
set -u

OUR_HOME="`dirname "$0"`/"

REPO_ROOT="http://XXXXX/archiva/repository/"

COMPONENT="$1"
VERSION="$2"


echo "Using REPO_PREFIX: $REPO_PREFIX"

INSTALL_ROOT="${HOME}"
INSTALL_COMPONENT_ROOT="${INSTALL_ROOT}/${COMPONENT}"

mkdir -p "${INSTALL_COMPONENT_ROOT}"

TMP_DIR=/tmp/VenomComponentZip/${COMPONENT}-`date -u "+%Y-%m-%d-%H:%M:%S.%N"`
mkdir -p $TMP_DIR


########################################
# Special handling for TomCat Components
########################################
if [ ${COMPONENT} == "FXAllocationsUI" -o ${COMPONENT} == "TraderClientPnL" ] ; then

    wget -nv -P ${INSTALL_COMPONENT_ROOT} "${REPO_ROOT}/${REPO_PREFIX}/${COMPONENT}/${VERSION}/${COMPONENT}-${VERSION}.war"
    pushd $INSTALL_COMPONENT_ROOT
    rm -f ${COMPONENT}.war
    ln -s ${COMPONENT}-${VERSION}.war ${COMPONENT}.war

    rm -rf $TMP_DIR

    exit
fi


##################################
# Special handling foHome
##################################
if [[ ${COMPONENT} == "xxxHome" ]]
    then
    #Special handling for xxxHome which is not a Java component
    case $USER in
    eufxcdev)
        ENVIRONMENT=dev
        ENVIRONMENT_NAME=test.ln;;
    eufxcstg)
        ENVIRONMENT=stage
        ENVIRONMENT_NAME=stage.ln;;
    eufxcprd)
        ENVIRONMENT=prod
        ENVIRONMENT_NAME=prod.ln;;
    *)
        echo "Error calculating environment based on current user $USER"
        EXIT 3
    esac

    xxxHOME_ZIP_FILENAME=${COMPONENT}-${VERSION}-${ENVIRONMENT}.zip

    wget -nv -P $TMP_DIR "${REPO_ROOT}/${REPO_PREFIX}/${COMPONENT}/${VERSION}/${xxxHOME_ZIP_FILENAME}"

    unzip -d $TMP_DIR $TMP_DIR/$xxxHOME_ZIP_FILENAME "xxxHome/$ENVIRONMENT_NAME/*"

    TARGET_DIRECTORY=$INSTALL_COMPONENT_ROOT/${ENVIRONMENT_NAME}-$VERSION

    if [ -e "$TARGET_DIRECTORY" ] ; then
        echo "xxxHome version is already deployed. Delete it if you want a redeploy: $TARGET_DIRECTORY"
        echo "Please manually remove the soft link from the home directory and point to the required version."
        exit 26
    fi

    mv $TMP_DIR/xxxHome/$ENVIRONMENT_NAME $TARGET_DIRECTORY

    if [[ $ENVIRONMENT == "dev" ]]
    then
        echo "Not setting soft link $ENVIRONMENT_NAME. In the development environment, xxxHome is taken from SVN"
    else
        echo "Deleting and recreating soft link: $ENVIRONMENT_NAME"
        pushd $INSTALL_COMPONENT_ROOT
        rm -f ${ENVIRONMENT_NAME}
        ln -s ${ENVIRONMENT_NAME}-$VERSION ${ENVIRONMENT_NAME}
    fi

    rm -rf $TMP_DIR

    exit #Finished processing for xxxHome
fi
########################################
# END - Special handling for xxxHome
########################################


wget -nv -P $TMP_DIR "${REPO_ROOT}/${REPO_PREFIX}/${COMPONENT}/${VERSION}/${COMPONENT}-${VERSION}-Server.zip"

unzip "$TMP_DIR/${COMPONENT}-${VERSION}-Server.zip" -d "${INSTALL_COMPONENT_ROOT}"
$OUR_HOME/moveJarsToShared ${INSTALL_COMPONENT_ROOT}/${COMPONENT}-${VERSION}/lib ${COMPONENT}-${VERSION}

if [ $? -eq 0 ] ; then
    function noSelector {
        echo "No Selector zip for this project"
        NO_SELECTOR=true
    }
    #Don't fail and exit the script if we get a 404 on the file. It's a valid condition to have no selector zip.
    NO_SELECTOR=false
    wget -nv -q -P $TMP_DIR "${REPO_ROOT}/${REPO_PREFIX}/${COMPONENT}/${VERSION}/${COMPONENT}-${VERSION}-Selector.zip" || noSelector

    if [ $NO_SELECTOR == false ] ; then
        echo "Selector zip is present"
        unzip "$TMP_DIR/${COMPONENT}-${VERSION}-Selector.zip" -d "${INSTALL_COMPONENT_ROOT}"
    fi

    echo "Creating soft link called live pointing to the newly deployed version"
    pushd ${INSTALL_COMPONENT_ROOT}
    rm -f live
    ln -s ${COMPONENT}-$VERSION live
    popd
fi

rm -rf $TMP_DIR

 

 

标签:TMP,ENVIRONMENT,deploy,COMPONENT,maven,VERSION,configuration,ROOT,DIR
From: https://blog.51cto.com/u_6174294/6235312

相关文章

  • MAVEN MavenResourcesFiltering NoClassDefFoundError
    MAVENMavenResourcesFiltering NoClassDefFoundError [WARNING]Errorinjecting:org.apache.maven.plugin.resources.ResourcesMojojava.lang.NoClassDefFoundError:Lorg/apache/maven/shared/filtering/MavenResourcesFiltering; 解决办法一(估计是maven插件包的问题):删除.m......
  • MAVEN 配置nexus setting.xml 配置
    MAVEN配置nexussetting.xml配置 <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.1.104:8081/nexus/content/groups/public/</url> </mirror> <profile> <id>nexus&......
  • jar包运行后显示 没有主清单属性 IDEA 使用maven打jar包两种方式及pom配置
    jar包运行后显示没有主清单属性IDEA使用maven打jar包两种方式及pom配置原文链接:https://blog.csdn.net/weixin_42585386/article/details/115334503目录问题现象:问题分析:解决方法:问题现象:        jar包运行后显示没有主清单属性!问题分析:1. 缺少了项目......
  • IDEA从零到精通(21)之使用Maven clean发生错误Process terminated
    IDEA从零到精通(21)之使用Mavenclean发生错误Processterminated原文链接:https://blog.csdn.net/dkm123456/article/details/121871870文章目录作者简介引言导航热门专栏推荐错误描述解决方案:再次clean小结导航热门专栏推荐作者简介作者名:编程界明世隐简介:CSDN博客......
  • Maven指令打包SpringBoot项目提示没有主清单文件
    Maven指令打包SpringBoot项目提示没有主清单文件原文链接:https://blog.csdn.net/greedystar/article/details/86068314项目打包为Jar后,通过java-jarxxxxx.jar运行时提示xxxxx.jar中没有主清单属性,如下:打开jar包,META-INF目录下的MANIFEST.MF,内容如下:Manifest-Version:1.0A......
  • maven中切换国内源
    国外镜像下载包非常慢,于是使用国内阿里云的,找到~/.m2目录,但是不存在settings.xml,于是手动创建一个,然后贴入一个样例 <settingsxmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="http://mave......
  • Unknown run configuration type SpringBootApplicationConfigurationType;Servlet Ser
    UnknownrunconfigurationtypeSpringBootApplicationConfigurationType社区版的idea自己安装插件,去配置大家可分享关于Java微服务相关知识,包括但不限于Java微服务开发经验、架构组成、技术交流、中间件等内容,我们鼓励springcloud架构为基础发散出击,从而达到技术积累的目的,快来沉......
  • 在我的mac mini上安装好maven后再次创建项目遇到同样的问题,再次记录一下
    默认生成的maven项目,使用mvnarchetype:generate按照提示生成的项目,使用mvncompile编译过后,mvnpackage,因为已经有jar的plugin了,java-jartarget/projct1.jar出现找不到主类,此时要配置pom.xml里面的maven-jar-plugin,方法是在下面添加配置段:<configuration><archive>......
  • maven本地配置规范
    关于私有仓库配置放在项目根pom.xml文件中<repositories><repository><id>internalrepository</id><name>Localrepository</name><url>https://xxx/artifactory/libs-snapshot-lo......
  • IDEA+Maven 打jar包
    IDEA+Maven打jar包原文链接:https://blog.csdn.net/qq_46416934/article/details/124146569IDEA+Maven打jar包(包涵依赖jar)最新修改以前写的打包方式可能看起来有些繁琐,这里给出进一步简洁的解决方案简单粗暴写在前面:这两天一直在整(gu)理(dao)IDEA用Maven打jar包,网上的教......