forked from mj/devopsscripts
初次提交
This commit is contained in:
28
backend/Dockerfile
Normal file
28
backend/Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
FROM harbor.zzmjart.com/library/compile:1.0.0 as builder
|
||||
COPY .git .git
|
||||
COPY src src
|
||||
COPY pom.xml .
|
||||
COPY settings.xml .
|
||||
RUN mvn -s ./settings.xml clean package -DskipTests=true
|
||||
|
||||
|
||||
FROM harbor.zzmjart.com/library/java17:1.0.0
|
||||
ARG PROJECTCODE
|
||||
ARG PROJECTVERSION
|
||||
LABEL author=wangchuan<wangzefu520@163.com>
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
COPY --from=builder /opt/app/target/*.jar $APP_HOME
|
||||
ENV ENV_ACTIVE="prod" \
|
||||
PROJECT_NAME="${PROJECTCODE}" \
|
||||
PROJECT_VERSION="${PROJECTVERSION}" \
|
||||
JAVA_OPS="" \
|
||||
APP_OPS="" \
|
||||
SKYWALKING_OPS="" \
|
||||
GC_OPS="-XX:+UseG1GC -XX:+UseStringDeduplication -XX:+OptimizeStringConcat -XX:+HeapDumpOnOutOfMemoryError -Xlog:gc*=info:file=$LOGS_HOME/gc.log:time,level,tags:filecount=30,filesize=50M -XX:HeapDumpPath=$LOGS_HOME/app.dump"
|
||||
RUN addgroup -g 1000 1000 && \
|
||||
adduser -u 1000 -G 1000 -S -D -H 1000 && \
|
||||
chown 1000:1000 -R $APP_HOME $LOGS_HOME && \
|
||||
chmod 744 /usr/local/bin/docker-entrypoint.sh && \
|
||||
chmod 444 $APP_HOME/*.jar
|
||||
WORKDIR $APP_HOME
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
326
backend/apprun.sh
Normal file
326
backend/apprun.sh
Normal file
@@ -0,0 +1,326 @@
|
||||
#!/usr/bin/bash
|
||||
# 项目名称
|
||||
PROJECT_NAME=
|
||||
# 项目镜像名称
|
||||
IMAGE_NAME=
|
||||
################### 可选配置 #####################
|
||||
# 公司名称
|
||||
COMPANY_NAME=mingjiang
|
||||
# 网络名称
|
||||
NETWORK_NAME=${COMPANY_NAME}_network
|
||||
# 服务端口及容器透出端口,多个以,分割,服务端口与透出端口以:进行分割,格式为:服务端口:透出到服务器端口
|
||||
# ***** 服务默认第一个端口为注册eureka端口 《《重要》》 *****
|
||||
# ***** 必须至少存在一个映射端口 *****
|
||||
# SERVER_PORTS=8800:8801,8811
|
||||
# SERVER_PORTS=8080
|
||||
# java虚拟机配置
|
||||
JAVA_OPS="-Xms1024m -Xmx1024m -Xss512k -XX:-UseGCOverheadLimit"
|
||||
# 链路追踪路径
|
||||
SKYWALKING_OPS=
|
||||
# 项目目录路径
|
||||
ROOT_PREFIX_DIR=/usr/local/$COMPANY_NAME
|
||||
# 是否启用XXL-JOB启动检测,默认不启用
|
||||
ENABLE_XXLJOB=0
|
||||
# 日志存放路径
|
||||
LOG_PATH=$ROOT_PREFIX_DIR/logs/$PROJECT_NAME
|
||||
|
||||
|
||||
# 使用说明
|
||||
usage() {
|
||||
echo "
|
||||
===============================================================================================================
|
||||
Usage:sh 执行脚本.sh [update|start|stop|restart|remove|status|version|images]
|
||||
update:更新镜像 会查询当前是否有.tar.gz的镜像文件,则将镜像加载到镜像列表,文件列表则为镜像名称,并删除镜像文件
|
||||
start:启动服务 根据最新镜像版本启动当前服务程序
|
||||
stop:停止服务 停止当前服务容器
|
||||
restart:重启 停止当前服务容器,并删除容器,并以服务最新镜像拉起服务容器
|
||||
remove:删除 删除当前服务容器,就算容器正在运行也会被强制删除
|
||||
status:服务状态 查询当前服务是否在运行中,如果在运行则打印出当前运行容器信息
|
||||
version:当前版本 查看当前容器使用的镜像版本
|
||||
images:服务镜像版本列表 查看当前服务的镜像版本列表
|
||||
===============================================================================================================
|
||||
"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# 判断是否存在docker容器
|
||||
has_docker() {
|
||||
docker version > /etc/null
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo "docker is not install"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 判断是否存在当前应用的镜像
|
||||
has_image() {
|
||||
c=$(docker images|grep $IMAGE_NAME[[:blank:]]|wc -l)
|
||||
if [ $c = 0 ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# 判断是否存在网络连接
|
||||
checkOrCreate_network() {
|
||||
c=$(docker network list|grep "${NETWORK_NAME}[[:blank:]]"|wc -l)
|
||||
if [ $c = 0 ]
|
||||
then
|
||||
docker network create $NETWORK_NAME >/dev/null
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# 查询清理镜像
|
||||
clear_image() {
|
||||
rows=$(docker images -f reference="$IMAGE_NAME"|wc -l)
|
||||
if [ $rows -ge 1 ]
|
||||
then
|
||||
docker rmi -f $(docker images -f reference="$IMAGE_NAME" -q)
|
||||
echo "服务 $PROJECT_NAME 容器删除成功"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 判断容器是否在运行
|
||||
has_run() {
|
||||
rows=$(docker ps -f name=$PROJECT_NAME\$|wc -l)
|
||||
if [ $rows -eq 1 ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
has_container() {
|
||||
rows=$(docker ps -a -f name=$PROJECT_NAME\$|wc -l)
|
||||
if [ $rows -eq 1 ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 停止运行的jar服务
|
||||
stop_jar_run() {
|
||||
pid=$(ps -ef|grep $PROJECT_NAME-|grep -v grep|awk '{print $2}')
|
||||
if [ ! -z "$pid" ]
|
||||
then
|
||||
kill $pid
|
||||
fi
|
||||
}
|
||||
|
||||
# 判断是否有当前服务未启动
|
||||
has_stop_container() {
|
||||
containerId=$(docker ps -a -f name=$PROJECT_NAME\$|grep Exited|awk '{print $1}')
|
||||
if [ -z "$containerId" ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# 应用端口映射信息处理
|
||||
port_map_processor() {
|
||||
if [ -z "$SERVER_PORTS" ];then
|
||||
echo ""
|
||||
fi
|
||||
portMap=""
|
||||
IFS=',' read -ra pairs <<< "$SERVER_PORTS"
|
||||
for pair in "${pairs[@]}"; do
|
||||
if [[ $pair == *:* ]];then
|
||||
# 按照冒号分割每个字符串
|
||||
IFS=':' read -ra ports <<< "$pair"
|
||||
portMap="${portMap} -p ${ports[1]}:${ports[0]}"
|
||||
else
|
||||
portMap="${portMap} -p ${pair}:${pair}"
|
||||
fi
|
||||
done
|
||||
echo "$portMap"
|
||||
}
|
||||
|
||||
# 加载镜像
|
||||
load_image() {
|
||||
clear_image
|
||||
imageFiles=$(ls -1 -v $(pwd)|grep $IMAGE_NAME|grep tar.gz)
|
||||
for imageFile in ${imageFiles}; do
|
||||
version=$(echo $imageFile | sed "s/.tar.gz//g" | sed "s/$IMAGE_NAME//g" | sed "s/_//g")
|
||||
if [ -n "$version" ]
|
||||
then
|
||||
echo "服务 $PROJECT_NAME 最新镜像为 $imageFile 版本为 $version"
|
||||
tar xvf $imageFile
|
||||
imageName=$(echo $imageFile | sed "s/.gz//g")
|
||||
if [ -n "$imageName" ]
|
||||
then
|
||||
docker load < $imageName
|
||||
echo "服务 $PROJECT_NAME 镜像 $imageFile 版本为 $version 导入成功"
|
||||
rm -rf $imageName
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 启动容器
|
||||
run() {
|
||||
if [ ! -d "$LOG_PATH" ]
|
||||
then
|
||||
mkdir -p $LOG_PATH
|
||||
fi
|
||||
stop_jar_run
|
||||
latestImageId=$(docker images|grep $IMAGE_NAME[[:blank:]]|sort -r|head -1|awk '{OFS=":"}{print $1,$2}')
|
||||
echo "服务 $PROJECT_NAME 最新镜像ID为 $latestImageId"
|
||||
has_stop_container
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
containerId=$(docker ps -a -f name=$PROJECT_NAME\$|awk '{print $1}'|sed -n 2p)
|
||||
nowImage=$(docker ps -a -f name=$PROJECT_NAME\$|awk '{print $2}'|sed -n 2p)
|
||||
if [ $nowImage != $latestImageId ]
|
||||
then
|
||||
docker rm -f $containerId
|
||||
else
|
||||
docker restart $containerId
|
||||
echo "服务 $PROJECT_NAME 启动成功"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
checkOrCreate_network
|
||||
containerLogPath=/usr/local/$COMPANY_NAME/logs
|
||||
if [ -e "$(pwd)/.env" ];then
|
||||
docker run -d -v /etc/localtime:/etc/localtime:ro --env-file .env -e JAVA_OPS="$JAVA_OPS" $(port_map_processor) -v $LOG_PATH:$containerLogPath --network=$NETWORK_NAME --restart=always --name $PROJECT_NAME $latestImageId
|
||||
echo "启动命令为: docker run -d -v /etc/localtime:/etc/localtime:ro --env-file .env -e JAVA_OPS=\"$JAVA_OPS\" $(port_map_processor) -v $LOG_PATH:$containerLogPath --network=$NETWORK_NAME --restart=always --name $PROJECT_NAME $latestImageId"
|
||||
else
|
||||
docker run -d -v /etc/localtime:/etc/localtime:ro -e JAVA_OPS="$JAVA_OPS" $(port_map_processor) -v $LOG_PATH:$containerLogPath --network=$NETWORK_NAME --restart=always --name $PROJECT_NAME $latestImageId
|
||||
echo "启动命令为: docker run -d -v /etc/localtime:/etc/localtime:ro -e JAVA_OPS=\"$JAVA_OPS\" $(port_map_processor) -v $LOG_PATH:$containerLogPath --network=$NETWORK_NAME --restart=always --name $PROJECT_NAME $latestImageId"
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新镜像
|
||||
update() {
|
||||
has_docker
|
||||
load_image
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
echo "服务 $PROJECT_NAME 更新镜像成功"
|
||||
fi
|
||||
}
|
||||
|
||||
# 启动镜像容器
|
||||
start() {
|
||||
has_docker
|
||||
has_image
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
load_image
|
||||
has_image
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo "服务 $PROJECT_NAME 镜像不存在,启动失败"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
has_run
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
run
|
||||
else
|
||||
echo "服务 $PROJECT_NAME 容器已在运行中"
|
||||
fi
|
||||
}
|
||||
|
||||
# 停止镜像容器
|
||||
stop() {
|
||||
has_docker
|
||||
has_run
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
docker stop $(docker ps -f name=$PROJECT_NAME\$|awk '{print $1}'|sed -n 2p)
|
||||
echo "服务 $PROJECT_NAME 容器停止成功"
|
||||
fi
|
||||
}
|
||||
|
||||
# 重启容器
|
||||
restart() {
|
||||
has_docker
|
||||
has_run
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
docker rm -f $(docker ps -a -f name=$PROJECT_NAME\$|awk '{print $1}'|sed -n 2p)
|
||||
fi
|
||||
load_image
|
||||
run
|
||||
}
|
||||
|
||||
# 删除容器
|
||||
remove() {
|
||||
has_docker
|
||||
has_container
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
docker rm -f $(docker ps -a -f name=$PROJECT_NAME\$|awk '{print $1}'|sed -n 2p)
|
||||
echo "服务 $PROJECT_NAME 容器删除成功"
|
||||
fi
|
||||
}
|
||||
|
||||
# 加载当前版本执行状态
|
||||
status() {
|
||||
has_docker
|
||||
has_run
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
docker ps -f name=$PROJECT_NAME\$
|
||||
else
|
||||
echo "$PROJECT_NAME 未运行"
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取当前服务所使用的镜像版本
|
||||
version() {
|
||||
has_docker
|
||||
has_run
|
||||
if [ $? = 0 ]
|
||||
then
|
||||
echo "当前使用版本为:$(docker ps -f name=$PROJECT_NAME\$ --format {{.Image}})"
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取当前服务所存在的镜像版本
|
||||
images() {
|
||||
has_docker
|
||||
echo "当前使用镜像为:$(docker images|grep $IMAGE_NAME[[:blank:]]|awk '{OFS=":"}{print $1,$2}')"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
"update")
|
||||
update
|
||||
;;
|
||||
"start")
|
||||
start
|
||||
;;
|
||||
"stop")
|
||||
stop
|
||||
;;
|
||||
"restart")
|
||||
restart
|
||||
;;
|
||||
"remove")
|
||||
remove
|
||||
;;
|
||||
"status")
|
||||
status
|
||||
;;
|
||||
"version")
|
||||
version
|
||||
;;
|
||||
"images")
|
||||
images
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
9
backend/docker-entrypoint.sh
Normal file
9
backend/docker-entrypoint.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
JAR_NAME=$(ls |grep \.jar)
|
||||
chown -R 1000:1000 $APP_HOME
|
||||
if [ ! -d "$LOGS_HOME" ];then
|
||||
gosu 1000 mkdir -p $LOGS_HOME
|
||||
else
|
||||
chown -R 1000:1000 $LOGS_HOME
|
||||
fi
|
||||
exec gosu 1000 java $JAVA_OPS -server $SKYWALKING_OPS $GC_OPS -Duser.timezone=GMT+08 -jar $APP_HOME/$JAR_NAME --spring.profiles.active=$ENV_ACTIVE $APP_OPS
|
||||
4
backend/settings-security.xml
Normal file
4
backend/settings-security.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<settingsSecurity>
|
||||
<master>{qBtk71LjY9wHaEzM4sXvM2rQjjSeiagK5Oi2c4koBc8=}</master>
|
||||
</settingsSecurity>
|
||||
318
backend/settings.xml
Normal file
318
backend/settings.xml
Normal file
@@ -0,0 +1,318 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<!--
|
||||
| This is the configuration file for Maven. It can be specified at two levels:
|
||||
|
|
||||
| 1. User Level. This settings.xml file provides configuration for a single user,
|
||||
| and is normally provided in ${user.home}/.m2/settings.xml.
|
||||
|
|
||||
| NOTE: This location can be overridden with the CLI option:
|
||||
|
|
||||
| -s /path/to/user/settings.xml
|
||||
|
|
||||
| 2. Global Level. This settings.xml file provides configuration for all Maven
|
||||
| users on a machine (assuming they're all using the same Maven
|
||||
| installation). It's normally provided in
|
||||
| ${maven.conf}/settings.xml.
|
||||
|
|
||||
| NOTE: This location can be overridden with the CLI option:
|
||||
|
|
||||
| -gs /path/to/global/settings.xml
|
||||
|
|
||||
| The sections in this sample file are intended to give you a running start at
|
||||
| getting the most out of your Maven installation. Where appropriate, the default
|
||||
| values (values used when the setting is not specified) are provided.
|
||||
|
|
||||
|-->
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
|
||||
<!-- localRepository
|
||||
| The path to the local repository maven will use to store artifacts.
|
||||
|
|
||||
| Default: ${user.home}/.m2/repository
|
||||
<localRepository>/path/to/local/repo</localRepository>
|
||||
-->
|
||||
|
||||
<!-- interactiveMode
|
||||
| This will determine whether maven prompts you when it needs input. If set to false,
|
||||
| maven will use a sensible default value, perhaps based on some other setting, for
|
||||
| the parameter in question.
|
||||
|
|
||||
| Default: true
|
||||
<interactiveMode>true</interactiveMode>
|
||||
-->
|
||||
|
||||
<!-- offline
|
||||
| Determines whether maven should attempt to connect to the network when executing a build.
|
||||
| This will have an effect on artifact downloads, artifact deployment, and others.
|
||||
|
|
||||
| Default: false
|
||||
<offline>false</offline>
|
||||
-->
|
||||
|
||||
<!-- pluginGroups
|
||||
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
|
||||
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
|
||||
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|
||||
|-->
|
||||
<pluginGroups>
|
||||
<!-- pluginGroup
|
||||
| Specifies a further group identifier to use for plugin lookup.
|
||||
<pluginGroup>com.your.plugins</pluginGroup>
|
||||
-->
|
||||
</pluginGroups>
|
||||
|
||||
<!-- TODO Since when can proxies be selected as depicted? -->
|
||||
<!-- proxies
|
||||
| This is a list of proxies which can be used on this machine to connect to the network.
|
||||
| Unless otherwise specified (by system property or command-line switch), the first proxy
|
||||
| specification in this list marked as active will be used.
|
||||
|-->
|
||||
<proxies>
|
||||
<!-- proxy
|
||||
| Specification for one proxy, to be used in connecting to the network.
|
||||
|
|
||||
<proxy>
|
||||
<id>optional</id>
|
||||
<active>true</active>
|
||||
<protocol>http</protocol>
|
||||
<username>proxyuser</username>
|
||||
<password>proxypass</password>
|
||||
<host>proxy.host.net</host>
|
||||
<port>80</port>
|
||||
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
|
||||
</proxy>
|
||||
-->
|
||||
</proxies>
|
||||
|
||||
<!-- servers
|
||||
| This is a list of authentication profiles, keyed by the server-id used within the system.
|
||||
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|
||||
|-->
|
||||
<servers>
|
||||
<!-- server
|
||||
| Specifies the authentication information to use when connecting to a particular server, identified by
|
||||
| a unique name within the system (referred to by the 'id' attribute below).
|
||||
|
|
||||
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
|
||||
| used together.
|
||||
|
|
||||
<server>
|
||||
<id>deploymentRepo</id>
|
||||
<username>repouser</username>
|
||||
<password>repopwd</password>
|
||||
</server>
|
||||
-->
|
||||
|
||||
<!-- Another sample, using keys to authenticate.
|
||||
<server>
|
||||
<id>siteServer</id>
|
||||
<privateKey>/path/to/private/key</privateKey>
|
||||
<passphrase>optional; leave empty if not used.</passphrase>
|
||||
</server>
|
||||
-->
|
||||
<server>
|
||||
<id>maven-public</id>
|
||||
<username>mingjiang</username>
|
||||
<password>{PRDE3xgOQZAHLKVHx1c+rFADPZRntXqCd1yr/R9qsK2CmLMM0ZtMQxOkNGyEnsuY}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>releases</id>
|
||||
<username>mingjiang</username>
|
||||
<password>{PRDE3xgOQZAHLKVHx1c+rFADPZRntXqCd1yr/R9qsK2CmLMM0ZtMQxOkNGyEnsuY}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>snapshots</id>
|
||||
<username>mingjiang</username>
|
||||
<password>{PRDE3xgOQZAHLKVHx1c+rFADPZRntXqCd1yr/R9qsK2CmLMM0ZtMQxOkNGyEnsuY}</password>
|
||||
</server>
|
||||
</servers>
|
||||
|
||||
<!-- mirrors
|
||||
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
||||
|
|
||||
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
|
||||
| However, this repository may have problems with heavy traffic at times, so people have mirrored
|
||||
| it to several places.
|
||||
|
|
||||
| That repository definition will have a unique id, so we can create a mirror reference for that
|
||||
| repository, to be used as an alternate download site. The mirror site will be the preferred
|
||||
| server for that repository.
|
||||
|-->
|
||||
<mirrors>
|
||||
<!-- mirror
|
||||
| Specifies a repository mirror site to use instead of a given repository. The repository that
|
||||
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
|
||||
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
||||
|
|
||||
<mirror>
|
||||
<id>mirrorId</id>
|
||||
<mirrorOf>repositoryId</mirrorOf>
|
||||
<name>Human Readable Name for this Mirror.</name>
|
||||
<url>http://my.repository.com/repo/path</url>
|
||||
</mirror>
|
||||
-->
|
||||
<mirror>
|
||||
<id>maven-public</id>
|
||||
<name>maven-public</name>
|
||||
<mirrorOf>central</mirrorOf>
|
||||
<url>https://nexus.zzmjart.com/repository/maven-public/</url>
|
||||
</mirror>
|
||||
</mirrors>
|
||||
|
||||
<!-- profiles
|
||||
| This is a list of profiles which can be activated in a variety of ways, and which can modify
|
||||
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
|
||||
| specific paths and repository locations which allow the build to work in the local environment.
|
||||
|
|
||||
| For example, if you have an integration testing plugin - like cactus - that needs to know where
|
||||
| your Tomcat instance is installed, you can provide a variable here such that the variable is
|
||||
| dereferenced during the build process to configure the cactus plugin.
|
||||
|
|
||||
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
|
||||
| section of this document (settings.xml) - will be discussed later. Another way essentially
|
||||
| relies on the detection of a property, either matching a particular value for the property,
|
||||
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
|
||||
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
|
||||
| Finally, the list of active profiles can be specified directly from the command line.
|
||||
|
|
||||
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
|
||||
| repositories, plugin repositories, and free-form properties to be used as configuration
|
||||
| variables for plugins in the POM.
|
||||
|
|
||||
|-->
|
||||
<profiles>
|
||||
<!-- profile
|
||||
| Specifies a set of introductions to the build process, to be activated using one or more of the
|
||||
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
|
||||
| or the command line, profiles have to have an ID that is unique.
|
||||
|
|
||||
| An encouraged best practice for profile identification is to use a consistent naming convention
|
||||
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
|
||||
| This will make it more intuitive to understand what the set of introduced profiles is attempting
|
||||
| to accomplish, particularly when you only have a list of profile id's for debug.
|
||||
|
|
||||
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
|
||||
<profile>
|
||||
<id>jdk-1.4</id>
|
||||
|
||||
<activation>
|
||||
<jdk>1.4</jdk>
|
||||
</activation>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jdk14</id>
|
||||
<name>Repository for JDK 1.4 builds</name>
|
||||
<url>http://www.myhost.com/maven/jdk14</url>
|
||||
<layout>default</layout>
|
||||
<snapshotPolicy>always</snapshotPolicy>
|
||||
</repository>
|
||||
</repositories>
|
||||
</profile>
|
||||
-->
|
||||
|
||||
<!--
|
||||
| Here is another profile, activated by the property 'target-env' with a value of 'dev', which
|
||||
| provides a specific path to the Tomcat instance. To use this, your plugin configuration might
|
||||
| hypothetically look like:
|
||||
|
|
||||
| ...
|
||||
| <plugin>
|
||||
| <groupId>org.myco.myplugins</groupId>
|
||||
| <artifactId>myplugin</artifactId>
|
||||
|
|
||||
| <configuration>
|
||||
| <tomcatLocation>${tomcatPath}</tomcatLocation>
|
||||
| </configuration>
|
||||
| </plugin>
|
||||
| ...
|
||||
|
|
||||
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
|
||||
| anything, you could just leave off the <value/> inside the activation-property.
|
||||
|
|
||||
<profile>
|
||||
<id>env-dev</id>
|
||||
|
||||
<activation>
|
||||
<property>
|
||||
<name>target-env</name>
|
||||
<value>dev</value>
|
||||
</property>
|
||||
</activation>
|
||||
|
||||
<properties>
|
||||
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
|
||||
</properties>
|
||||
</profile>
|
||||
-->
|
||||
<profile>
|
||||
<id>default</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven-public</id>
|
||||
<name>maven-public</name>
|
||||
<url>https://nexus.zzmjart.com/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
<updatePolicy>daily</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven-public</id>
|
||||
<name>maven-public</name>
|
||||
<url>https://nexus.zzmjart.com/repository/maven-public/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
<updatePolicy>daily</updatePolicy>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<checksumPolicy>fail</checksumPolicy>
|
||||
<updatePolicy>always</updatePolicy>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
<properties>
|
||||
<altReleaseDeploymentRepository>releases::default::https://nexus.zzmjart.com/repository/maven-releases</altReleaseDeploymentRepository>
|
||||
<altSnapshotDeploymentRepository>snapshots::default::https://nexus.zzmjart.com/repository/maven-snapshots</altSnapshotDeploymentRepository>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<activeProfiles>
|
||||
<activeProfile>default</activeProfile>
|
||||
</activeProfiles>
|
||||
</settings>
|
||||
Reference in New Issue
Block a user