0

I have tried to add below in pom.xml

<scope>system</scope>
<systemPath>${project.basedir}/lib/example-lib.jar</systemPath>

but didn't work.

More information that I found :

It might be related to spring boot maven plugin. https://docs.spring.io/spring-boot/docs/current/maven-plugin/ which it not included scope "system" lib when building jar.

Ref : https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryScope.java

Thank you in advanced.

korrawit
  • 1,000
  • 2
  • 18
  • 30
  • 1
    Possible duplicate of [Maven: best way of linking custom external JAR to my project?](http://stackoverflow.com/questions/5692256/maven-best-way-of-linking-custom-external-jar-to-my-project) – A_Di-Matteo Apr 12 '16 at 11:28
  • hold on.. I might be related to spring boot maven plugin. https://docs.spring.io/spring-boot/docs/current/maven-plugin/ which it not included scope "system" lib when building jar. Ref : https://github.com/spring-projects/spring-boot/blob/master/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/LibraryScope.java – korrawit Apr 12 '16 at 11:31
  • system scoped dependencies are never added to packaged artifacts, that's why system scope is kind of evil and should really be avoided in maven – A_Di-Matteo Apr 12 '16 at 12:18
  • #1 what do you mean by "but didn't work."? #2 Do you have an error in your log? #3 Do you have a environments like: dev, testing, prod? #4 Do you have an artifactory or nexus for your libraries? #5 Do you want to have a devops flow or Do you need just start your app in your local workspace? – JRichardsz Nov 30 '21 at 03:21

1 Answers1

0

I would suggest you to install the file to your local repo using below command. rather than using system path(as it would be difficult to manage paths when there are multiple developers(with more complexities with different OS))

mvn install:install-file -Dfile=<your jar file location\file name>.jar -DgroupId=com.kp<groupId> -DartifactId={your custom artifactId} -Dversion={version} -Dpackaging=jar

I use the above approach to use oracle's ojdbc.jar which is not part of Maven Repo.

Karthik Prasad
  • 9,662
  • 10
  • 64
  • 112