Spring Boot 打包systemPath的jar

Maven项目有时候有一些私有jar 比如:oracle的驱动

如果是boot项目,要打进jar包有多种方式:

方法1. 手动install jar到本地maven仓库,然后pom里面依赖

 install:install-file  -Dfile=E:ojdbc6.jar  -DgroupId=com.oracle  -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar

方法2. 安装nexus私有仓库,然后上传到私有仓库,pom配置仓库. https://www.cnblogs.com/tomcatandjerry/

<project ...> 
    <repositories>
        <repository>
            <id>rsmaven</id>
            <url>http://192.168.10.6:8081/nexus/content/groups/public/</url>
        </repository>
    </repositories>
</project>

方法3. 把jar放在项目里,配systemPath(项目根目录新建文件夹/libs, 把需要的jar放在里面)

<dependency>
  <groupId>com.oracle</groupId>
  <artifactId>ojdbc</artifactId>
  <version>11.2.0.3</version>
  <scope>system</scope>
  <systemPath>${basedir}/libs/ojdbc-11.2.0.4.jar</systemPath>
</dependency>

 build里增加配置 

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

  

  

原文地址:https://www.cnblogs.com/tomcatandjerry/p/10197260.html