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

相关推荐
日月星辰Ace11 小时前
Maven settings.xml
maven
三角叶蕨20 小时前
springboot入门、解析关键字
maven
一只学java的小汉堡2 天前
微服务与面向服务编程(SOA)入门指南:从架构演进到 Spring Cloud 实践(初学者友好版)
spring boot·spring cloud·java-ee·maven
间彧3 天前
Intellij IDEA Maven依赖自动补全和Maven Artifact Search为空问题
maven
Elieal3 天前
SpringMVC 入门:核心概念与第一个 HelloWorld 案例
mvc·maven
疯癫的老码农3 天前
【word解析】Java文件解析问题排查:无法找到OMML2MML.xsl的IO异常解析
java·开发语言·spring boot·spring·maven
叶 落4 天前
[Maven 基础课程]10_Maven 私服
maven·maven 入门·maven 基础课程·maven 基础
_院长大人_4 天前
阿里云云效将本地的maven相关文件批量推送到阿里云仓库以及使用
java·阿里云·maven
在下村刘湘4 天前
maven pom文件中<dependencyManagement><dependencies><dependency> 三者的区别
java·maven
李昊哲小课4 天前
Maven 完整教程
java·maven