1. 程式人生 > >MAVEN--本地jar打包

MAVEN--本地jar打包

Maven打包

在開發專案的時候,使用了第三方公司提供的jar包,只能引用器jar包。開發時候使用
<systemPath>${project.basedir}/lib/dcms-mq-client-1.0-SNAPSHOT.jar</systemPath>
進行引用,當打包時候 不成功,因此需要更改為
<systemPath>${pom.basedir}/lib/dcuc-client.jar</systemPath>
再次即可成功。(示例如下)

示例


<dependency>
            <groupId
>
com.houshuai</groupId> <artifactId>houshuai</artifactId> <version>1.0-SNAPSHOT</version> <scope>system</scope> <systemPath>${pom.basedir}/lib/dcms-mq-client-1.0-SNAPSHOT.jar</systemPath> <type
>
jar</type> <optional>true</optional> </dependency>

外掛配置

由於採用SpringBoot 進行 。則在外掛中增加
<includeSystemScope>true</includeSystemScope> 則可以成功匯入本地jar包。

    <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId
>
<artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable> <includeSystemScope>true</includeSystemScope> </configuration> </plugin> </plugins>