Java % Maven 环境配置

A little Mew
2021-09-21 12:45
41
0
  1. 下载文件解压
cd /usr/local/ 
tar -zxvf jdk-8u202-linux-x64.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-tomcat-8.5.70.tar.gz
  1. 配置环境
## 环境变量 Linux
export JAVA_HOME=/usr/local/jdk1.8.0_202
export CLASSPATH=.:$JAVA_HOME/lib
export M2_HOME=/usr/local/apache-maven-3.6.3
export PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin
  1. 修改Maven源 `sudo vim /usr/local/apache-maven-3.6.3/conf/settings.xml
<mirror>
        <id>alimaven</id>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
        <url>https://maven.aliyun.com/repository/public</url>
</mirror>

改完了复制到用户配置 cp /usr/local/apache-maven-3.6.3/conf/settings.xml ~/.m2/settings.xml

  1. Systemctl 管理 tomcat: 首先添加启动环境: vim catalina.sh 最前面写入 “2. 配置环境” 的内容,不知道为什么添加在 setenv.sh 的环境会无法启动

编辑 sudo vim /lib/systemd/system/tomcat.service

[Unit]
Description=tomcat
After=network.target
[Service]
Type=forking
PrivateTmp=true
User=admin
ExecStart=/usr/local/apache-tomcat-8.5.70/bin/catalina.sh start
ExecReload=/usr/local/apache-tomcat-8.5.70/bin/catalina.sh restart
ExecStop=/usr/local/apache-tomcat-8.5.70/bin/catalina.sh stop
[Install]
WantedBy=multi-user.target
  1. 管理 tomcat
## 启动
systemctl start tomcat
## 重启
systemctl restart tomcat
## 停止
systemctl stop tomcat
## 状态
systemctl status tomcat
## 其他的自己百度
  1. JPress
<div><i class="fa"></i><img src="#(article.user.avatar ??)" class="rounded-circle" alt=""></div>
<div><i class="fa"></i>#(article.user.nickname ??)</div>

全部评论