zoukankan      html  css  js  c++  java
  • maven项目中引入本地jar包及maven打包

    引入

    1、在项目选择一个目录用于存放xxx.jar包

    2、在pom添加如下配置:

    <dependency>
        <groupId>cn.com.sand</groupId>
        <artifactId>hmpay-sdk</artifactId>
        <version>1.1.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/src/main/resources/lib/hmpay-sdk-1.1.0.jar</systemPath>
    </dependency>

    groupId、artifactId、version 可以根据情况自行随意配置

    scope必须为system

    systemPath为项目中jar包存放的相对路径

    3、在pom添加包含本地scope的配置

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.1.3.RELEASE</version>
        <configuration>
            <includeSystemScope>true</includeSystemScope>
        </configuration>
    </plugin>

    打包

    在pom文件中添加plugin

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.0</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <encoding>UTF-8</encoding>
            <compilerArguments>
                <extdirs>${project.basedir}/src/main/resources/lib</extdirs>
            </compilerArguments>
        </configuration>
    </plugin>

    extdirs要添加到打包的目录

  • 相关阅读:
    C#解决界面不响应
    C#调用SendMessage 用法
    C#开机自动启动程序代码
    C# WinForm使用乐器数字接口
    以下C#程序的输出结果是( )。
    C# 关键字extern用法
    C#循环测试题
    C#播放wav文件
    Matches正则使用提取内容
    C#测试题若干,都是基础阿
  • 原文地址:https://www.cnblogs.com/fightingtong/p/14187884.html
Copyright © 2011-2022 走看看