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