1.這是我的jar包目錄
同時我還有Maven管理的包
如果不處理lib下面的jar包,使用maven構建jar格式的項目時會出現找不到類的錯誤,導致打包失敗
因爲我們使用maven方式打包,所以我們要將lib下面的jar與maven關聯起來
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/gson-2.7.jar</systemPath>
</dependency>
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/log4j-1.2.17.jar</systemPath>
</dependency>
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>MobileIMSDKServerX_netty</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/MobileIMSDKServerX_netty.jar</systemPath>
</dependency>
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>netty-all</artifactId>
<version>4.1.17</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/netty-all-4.1.17.Final.jar</systemPath>
</dependency>
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>rabbitmq-client</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/rabbitmq-client.jar</systemPath>
</dependency>
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/slf4j-api-1.7.21.jar</systemPath>
</dependency>
<dependency>
<groupId>com.yx.fenghua</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.21</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/slf4j-log4j12-1.7.21.jar</systemPath>
</dependency>
在maven導入包的地方根據格式導入項目中lib目錄下的包,其中
<groupId>com.yx.fenghua</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
上面這部分內容隨便填寫,
<scope>system</scope>
scope標籤不要修改
<systemPath>${project.basedir}/src/main/resources/lib/slf4j-log4j12-1.7.21.jar</systemPath>
systemPath標籤修改最後的名字就行,保證與lib下的名稱相同
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
build裏面的內容增加
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
然後點擊package
看到BUILD SUCCESS就是成功了
接下來去target下面就可以找到項目的jar包,這個jar是有java環境直接就可以運行的