maven项目引入私有jar,并打包到java.jar中

  1. 私有jar存放位置
    在这里插入图片描述
  2. maven依赖
<dependency>
    <groupId>com.hikvision.ga</groupId>
    <artifactId>artemis-http-client</artifactId>
    <version>1.1.10</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/lib/artemis-http-client-1.1.10.jar</systemPath>
</dependency>
  1. maven build
<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!--设置为true,以便把本地的system的jar也包括进来-->
                <includeSystemScope>true</includeSystemScope>
            </configuration>
        </plugin>
    </plugins>
</build>

你可能感兴趣的:(java,maven,jar)