springboot maven项目外部三方jar 打包

说明:springboot 搭建的maven项目中,现需要连同三方的jar包一起打包部署

步骤1:
pom.xml 文件中添加对应jar的配置

<dependency>
      <groupId>jarName1</groupId> <!--jar组包,自己取-->
      <artifactId>jarName1</artifactId> <!--jar包名,自己取-->
      <version>1.0</version> <!--jar版本,自己定-->
      <scope>system</scope>   <!--system:依赖项不会从maven仓库下载,而是从本地文件系统拿-->
      <systemPath>${project.basedir}/lib/com.jdbc.jar</systemPath><!--jar包的路径-->
    </dependency>
    
    <dependency>
      <groupId>jarName2</groupId>
      <artifactId>jarName2</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/commons-code-1.10.jar</systemPath>
    </dependency>
    
    <dependency>
      <groupId>jarName3</groupId>
      <artifactId>jarName3</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/commons-logging-1.2.jar</systemPath>
    </dependency>

    <dependency>
      <groupId>jarName4</groupId>
      <artifactId>jarName4</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/fluent-4.5.6.jar</systemPath>
    </dependency>
    <dependency>
      <groupId>jarName5</groupId>
      <artifactId>jarName5</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/httpclient-4.5.6.jar</systemPath>
    </dependency>

步骤2:

如果你的目标是War

<resources>
    <resource>
        <directory>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>

如果你的目标是Jar

     <plugin>
         <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <configuration>
            <webResources>
              <resource>
                <directory>lib</directory>
                <targetPath>WEB-INF/lib/</targetPath>
               <includes>
                 <include>**/*.jar</include>
               </includes>
             </resource>
           </webResources>
         </configuration>
      </plugin>  

步骤3:
maven-clean
maven-install

完成打包

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值