Spring-boot: The system scope dependency jar can't be packaged into fat jar when mvn clean install

Created on 28 Mar 2016  路  4Comments  路  Source: spring-projects/spring-boot

there is a dependency jar which not existing in the maven centre but locally

    <dependency>
      <groupId>routines</groupId>
      <artifactId>routines</artifactId>
      <version>1.0</version>
      <scope>system</scope>
      <systemPath>${basedir}/lib/routines.jar</systemPath>
    </dependency>

after mvn clean install, this dependency jar can't be found from the fat jar. is this an known-issue? the workaround is have to install it into local maven repo with command:
mvn install:install-file -Dfile=lib/routines.jar -DgroupId=org.talend -DartifactId=routines -Dversion=1.0 -Dpackaging=jar

then using normal dependency format in the pom.xml like this:

    <dependency>
      <groupId>org.talend</groupId>
      <artifactId>routines</artifactId>
      <version>1.0</version>
    </dependency>
invalid

Most helpful comment

This is quite old now, but in case the next person stumbles upon this, you can do what is described here:

https://stackoverflow.com/questions/30207842/add-external-library-jar-to-spring-boot-jar-internal-lib

This options worked for me:

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

All 4 comments

System dependencies are intentionally excluded from fat JARs since they may be platform specific and are usually provided by the JDK. Here's the relevant section of the Maven docs:

Dependencies with the scope system are always available and are not looked up in repository. They are usually used to tell Maven about dependencies which are provided by the JDK or the VM. Thus, system dependencies are especially useful for resolving dependencies on artifacts which are now provided by the JDK, but where available as separate downloads earlier. Typical example are the JDBC standard extensions or the Java Authentication and Authorization Service (JAAS).

This is quite old now, but in case the next person stumbles upon this, you can do what is described here:

https://stackoverflow.com/questions/30207842/add-external-library-jar-to-spring-boot-jar-internal-lib

This options worked for me:

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

thanks for replay, @pandaadb ,this config worked for me.

@pandaadb, Thanks, It worked for me

Was this page helpful?
0 / 5 - 0 ratings