博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
springboot有第三方jar打包成jar
阅读量:6233 次
发布时间:2019-06-21

本文共 3979 字,大约阅读时间需要 13 分钟。

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.cxwlw</groupId>

<artifactId>zhcs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>zhcs</name>

<description>zhcs</description>

<parent>

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
</dependencies>

<build>

<finalName>cyc</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>

</project>

 

pom.xml配置好

最主要的是

<build>

<finalName>cyc</finalName> //包的名字  
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>

//------------------------------------------------------(有第三方jar的配置开始)

<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
</resources>

//_________________________________________(第三方包配置结束)

</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>

打成jar配置

<build>

<finalName>cyc</finalName> //包的名字  
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>

 

</build>

<repositories> 
<repository> 
<id>spring-milestone</id> 
<url>http://repo.spring.io/libs-release</url> 
</repository> 
</repositories>

--------------------------------------------------------------------------------

第三方jar要放在src下面列如:src/lib(最好命名为lib方便)2个位置都放一下吧

 

最后打包

成功后刷新一下打好的包在

 

转载于:https://www.cnblogs.com/wudage/p/9003733.html

你可能感兴趣的文章
Linux禁用IPv6
查看>>
【转】linux 用户线程、LWP、内核线程学习笔记
查看>>
各种书籍
查看>>
使用注解开发springmvc
查看>>
BZOJ-4326: NOIP2015 运输计划 (二分+LCA+树上差分)
查看>>
linux并发控制之读写信号量
查看>>
MySQL表的四种分区类型
查看>>
Razor模板引擎
查看>>
Log4Net 日志配置[附带源码]
查看>>
企业级Nginx Web服务优化实战
查看>>
Google地图,Baidu地图数据供应商
查看>>
抽象类
查看>>
node溢出
查看>>
【转】充满浮躁的程序员
查看>>
jquery tips 提示层
查看>>
Python 之IO模型
查看>>
SSH项目tomcat发布时,Initializing Spring root WebApplicationContext卡死不动
查看>>
Lombok
查看>>
Single Number II
查看>>
由于一个老熟人对架构的一句话而拉黑了他。
查看>>