spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

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

Open xldai opened this issue 10 years ago • 7 comments

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>

xldai avatar Mar 28 '16 06:03 xldai

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).

philwebb avatar Mar 28 '16 06:03 philwebb

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>

pandaadb avatar Jan 25 '18 14:01 pandaadb

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

vito16 avatar May 08 '18 15:05 vito16

@pandaadb, Thanks, It worked for me

rakeshskc avatar Oct 11 '18 10:10 rakeshskc

works like a charm

musindo avatar Jul 05 '22 20:07 musindo

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>

worked for me, thankyou so much

abramofranchetti avatar Oct 03 '23 14:10 abramofranchetti

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>

Thank You a lot, this solution is my rescue :-)

joypad avatar Jan 12 '24 15:01 joypad