zoukankan      html  css  js  c++  java
  • Maven打包时引入本地jar包

    <!--pom.xml-->
    ..... <dependencies> <dependency> <groupId>com.xxxxxx</groupId> <artifactId>xxxxxx</artifactId> <version>x.x.x</version><!--版本随意填--> <scope>system</scope> <systemPath>${project.basedir}/src/main/resources/lib/brave-core-3.16.0.jar</systemPath><!--${project.basedir}是项目根目录,maven自带--> </dependency> </dependencies> <build> <plugins> .... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.2.0</version> <configuration> <webResources> <resource> <directory>${project.basedir}/src/main/resources/lib</directory> <targetPath>WEB-INF/lib</targetPath> <includes> <include>**/*.jar</include><!--打包时将jar加入打包--> </includes> </resource> <resource> <directory>${project.basedir}/src/main/resources/config</directory> <targetPath>WEB-INF/config</targetPath> <includes> <include>**/*.properties</include><!--打包时将propertis加入打包--> </includes> </resource> </webResources> <packagingExcludes><!--排除properties--> WEB-INF/classes/*.properties,WEB-INF/classes/config/**.properties </packagingExcludes> </configuration> </plugin> </plugins> </build> .....

      这样配置pom后maven打包的时候就会将本地的jar加入打包,就可以在maven项目中使用本地的jar了。

    但是,maven项目不推荐这种使用本地jar包的方式,因为maven的作用是统一管理项目,这样做的话,将代码上传svn或则git后,如果没有上传对应的本地jar,他人在开发时将会找不到jar包,而后人又完全不知道前人到底使用的哪一个jar所以无法补充该jar。

  • 相关阅读:
    (判断是否为弱联通分量) poj 2762
    (最大生成树) poj 1979
    (暴力) bzoj 2208
    (BFS) bzoj 1102
    (并查集) bzoj 1161
    (数学) bzoj 1800
    (博弈) bzoj 2460
    (dinic) poj 3469
    (双端队列优化的SPFA) bzoj 2100
    (判断负环) bzoj 2019
  • 原文地址:https://www.cnblogs.com/zhihow/p/10075939.html
Copyright © 2011-2022 走看看