Maven项目引入额外jar包
in 默认分类 with 0 comment

Maven项目引入额外jar包

in 默认分类 with 0 comment

方式1

将jar包放入项目内的某个路径里,然后添加依赖:

<!-- 引入外部jar -->
        <dependency>
            <groupId>com.henggao</groupId>
            <artifactId>sdk</artifactId>
            <version>3.1.0</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/resources/jar/sdkclient.jar</systemPath>
            <exclusions>
            </exclusions>
        </dependency>

其中systemPath填入jar包的位置,groupIdartifactIdversion字段随意。
还需要在build节点添加打包时引入

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

方式2

可以将jar包push到maven的本地仓库然后和普通maven依赖一样使用即可(还未试过)。

Responses