安装jdk11、安装maven、配置阿里源、打jar包

1、安装jdk11

下载jdk11
oracle网站登录账号:eddy1365@163.com
密码:Asdf*****
tar zxf jdk-11.0.21_linux-x64_bin.tar.gz
mv jdk-11.0.21 /opt/jdk
cat >>/etc/profile <<EOF
export JAVA_HOME=/opt/jdk-11.0.21
export PATH=/opt/jdk-11.0.21/bin:\$PATH
EOF
source /etc/profile

2、安装maven

下载maven
tar zxf apache-maven-3.9.6-bin.tar.gz
mv apache-maven-3.9.6 /opt/maven
cat >>/etc/profile <<EOF
export MAVEN_HOME=/opt/maven
export PATH=/opt/maven/bin:\$PATH
EOF
source /etc/profile

3、配置maven使用阿里源

在/opt/maven/conf/settings.xml中找到  <mirrors> 标记,在段落里添加阿里源:
  <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-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>        
    </mirror>
  </mirrors>

4、maven打jar包

-Dmaven.test.skip=true -DskipTests 用来加速打包

进入项目目录,与pom.xml同齐:
Dockerfile  docker.sh  pom.xml  README.md  src
运行命令:mvn package -Dmaven.test.skip=true -DskipTests
Categories: 系统运维