非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...

相关推荐
小宇宙Zz14 天前
Maven依赖冲突
java·服务器·maven
砚底藏山河15 天前
沪深A股:如何获取基金持股数据
java·python·数据分析·maven
一勺菠萝丶15 天前
Maven SNAPSHOT 父 POM 无法解析问题排查
java·maven
我登哥MVP15 天前
SpringCloud Alibaba 核心组件解析:服务链路追踪
java·spring boot·后端·spring·spring cloud·java-ee·maven
南部余额15 天前
Maven Archetype 项目模板
java·maven·项目·archetype
梦想的旅途215 天前
企业微信外部群自动化:一期交付应聚焦双向会话闭环
java·开发语言·机器人·自动化·maven·企业微信
vx-Biye_Design15 天前
springboot安阳地区研学旅游服务小程序-计算机毕业设计源码12785
java·vue.js·windows·spring boot·tomcat·maven·mybatis
Clang's Blog15 天前
Ubuntu(20.04/22.04/24.04)国内环境一键安装 Docker、JDK17 和 Maven
ubuntu·docker·maven
编程的一拳超人15 天前
Maven 国内高速镜像推荐(按速度排序)
java·maven
Orchestrator_me16 天前
Centos7安装maven 3.9.11
java·maven