非maven地址方式引入jar

需求

第三方jar,但没有公开的maven地址

解决方法

编译

手动添加依赖jar的目录

maven编译

xml 复制代码
<dependency>
    <groupId>local.libs</groupId>
    <artifactId>k3cloud-webapi-sdk8.0.6</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/k3cloud-webapi-sdk8.0.6.jar</systemPath>
</dependency>

maven打包

maven-war-plugin 里加入

xml 复制代码
<resource>
    <directory>${project.basedir}/lib</directory>
    <targetPath>WEB-INF/lib</targetPath>
    <includes>
       <include>*.jar</include>
    </includes>
</resource>

完整

xml 复制代码
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.1.1</version>
    <configuration>
       <!-- 排除images不进行打包--> 
       <!-- <warSourceExcludes>images/**</warSourceExcludes> -->
       <webResources>
          <resource>
             <filtering>true</filtering> 
             <directory>src/main/profile</directory>
             <targetPath>WEB-INF</targetPath>
             <includes>
                <include>**/web.xml</include>
             </includes>
          </resource>
          <resource>
             <filtering>true</filtering> 
             <directory>src/main/profile</directory>
             <targetPath>WEB-INF/classes</targetPath>
             <includes>
                <include>**/log4j.properties</include>
             </includes>
          </resource>

          <resource>
             <directory>${project.basedir}/lib</directory>
             <targetPath>WEB-INF/lib</targetPath>
             <includes>
                <include>*.jar</include>
             </includes>
          </resource>

       </webResources>
       <warSourceDirectory>src/main/webapp</warSourceDirectory>
       <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
    </configuration>
</plugin>

参考

www.cnblogs.com/lmj612/p/10...

相关推荐
想进大厂的小徐10 小时前
maven的子模块和子pom的区别
java·maven
Samson Bruce11 小时前
【Maven Spring Nacos之profile】
maven
Skilce20 小时前
ZrLog 高可用部署
运维·服务器·数据库·阿里云·maven
福运常在2 天前
股票数据API(21)如何获取股票指数最新分时交易数据
java·python·maven
Riu_Peter2 天前
【技术】Maven 配置 settings.xml 轮询下载
xml·java·maven
中国胖子风清扬2 天前
实战:基于 Camunda 8 的复杂审批流程实战指南
java·spring boot·后端·spring·spring cloud·ai·maven
zb200641202 天前
Spring Boot spring-boot-maven-plugin 参数配置详解
spring boot·后端·maven
圣光SG2 天前
Maven 学习笔记(基础入门版)
笔记·maven
deelless3 天前
IDEA maven项目添加本地jar包
maven·intellij-idea·jar
Dylan的码园3 天前
maven入门与核心功能介绍
java·maven