关于maven pom文件配置加载lib下的jar包
目录
- maven pom文件配置加载lib下的jar包
- 项目需要引用第三方放在lib的jar
- springboot项目可以加上配置
- 附录
- 总结
maven pom文件配置加载lib下的jar包
项目需要引用第三方放在lib的jar
所以需要进行配置,不过最好还是放在公司自己的maven私服里
<dependency>
<groupId>Javax.wsdl</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.5.1</version>
<scope>system</scope>
<systemPath>${basedir}/lib/wsdl4j.jar</systemPath>
</dependency>
这种外部依赖的jar,有时候部署有问题,可以使用maven jar plugins ,
参考官网:https://maven.apache.org/plugins/maven-jar-plugin/plugin-info.html
springboot项目可以加上配置
<dependencyManagement>
<dependencies>
<dependency>
<grjsoupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies<javascript/artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
编程客栈 <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.编程8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.7.RELEASE</version>
<configuration>
<mainClass>com.example.AleHandleServiceApplphpication</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
附录
maven的依赖范围:
compile:maven的默认依赖范围,此种依赖,在编译、运行、测试时都有效provided:在编译、测试时有效,但是在运行时无效runtime:在运行、测试时有效,但是在编译代码时无效test:只在测试时有效,包括测试代码的编译,执行system:在编译、测试时有效,但是在运行时无效
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程客栈(www.devze.com)。
加载中,请稍侯......
精彩评论