1.打包ruoyi-admin
mvn clean package -DskipTests
注意事项:
如果若依项目中模块中引入了本地jar包,需要修改ruoyi-admin下的pom.xml文件
假如:ruoyi-fish模块需要引入本地jar包
<dependency>
<groupId>org.tron.trident</groupId>
<artifactId>abi</artifactId>
<version>0.7.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/abi-0.7.0.jar</systemPath>
</dependency>
修改ruoyi-admin下的pom.xml文件
<!-- 如果没有该配置,ruoyi-fish中lib中的jar包不会被打包进去 -->
<includeSystemScope>true</includeSystemScope>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.15</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
<includeSystemScope>true</includeSystemScope> <!-- 如果没有该配置,ruoyi-fish中lib中的jar包不会被打包进去 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
2. 打包打包前端vue
yarn build:prod
3. 宝塔新建纯静态站点
- 上传前端代码
- 修改前端nginx配置
location / {
# 换成自己的前端地址
root /home/ruoyi/projects/ruoyi-h5;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
# 默认所有路径
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-NginX-Proxy true;
# 反向代理配置
proxy_pass http://localhost:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
- 新建java项目站点
需要在ruoyi-admin.jar目录新增两个文件夹logs和uploadPath