赞
踩
描述:下载了第三方相关jar包后,项目中引入本地jar,测试环境正常,打包线上报错提示为找到该jar
原因:应该在/WEB-INF/lib/xxx.jar,被打包到此目录:/WEB-INF/classes/lib/xxx.jar
引入jar包后,在此pom.xml文件中里面添加依赖坐标,即添加中内容
<dependencies>
<dependency>
<groupId>org.eclipse.paho.client.mqttv3_1.0.2_dms</groupId>
<artifactId>org.eclipse.paho.client.mqttv3_1.0.2_dms.jar</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>${pom.basedir}/src/main/resources/lib/org.eclipse.paho.client.mqttv3_1.0.2_dms.jar</systemPath>
</dependency>
</dependencies>
在pom的< build></ build>标签中还需进行如下修改,添加备注 打war包 之后带内容
<build>
<!-- war的名称 -->
<finalName>mall-portal</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
<!-- 打war包 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<!-- 配置将第三方jar打进war包中,跟<packaging>war</packaging>配合 -->
<webResource>
<directory>${pom.basedir}/src/main/resources/lib/</directory>
<targetPath>WEB-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</webResource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。