0

I want dependencies that are having system scope to be part of my project final executable jar. I tried maven-assembly, maven-shade and maven-dependency plugin. But using these plugins, only those dependency of my project which were present in my local maven repository were getting added. Dependency with system scope (not present in my local maven repo) are not getting added in the final executable jar.

I tried searching over google, but most of the links are suggesting to add it local maven repo first. I have some limitations so I cannot add those dependency on local repo. I want it to picked from file system directly, and wanted it to be part of final executable jar.

<!-- Teradta jdbc dependency -->

<dependency>
    <groupId>org.teradata</groupId>
    <artifactId>teradata</artifactId>
    <version>4.0</version>
    <scope>system</scope>
    <systemPath>${basedir}/../../../lib/terajdbc4.jar</systemPath>
</dependency>

Above dependency is not getting added in the final jar that maven is building.

Please suggest me the right plugin with its usage for this use case.

Any help on this would be really appreciated.

Reena Upadhyay
  • 1,977
  • 20
  • 35
  • 1
    As it has been said [many](http://stackoverflow.com/a/2068101/1743880) [times](http://stackoverflow.com/a/2230464/1743880) [before](http://stackoverflow.com/a/10935253/1743880), [**you**](http://stackoverflow.com/a/30347631/1743880) [**can't**](http://stackoverflow.com/a/13354413/1743880) [**do**](http://stackoverflow.com/a/5597277/1743880) [**it**](http://stackoverflow.com/a/2588641/1743880) – Tunaki Oct 26 '15 at 14:28
  • I'm voting to close this question as off-topic because this is asking to workaround something that cannot be workaround as this has been said many times before on SO. – Tunaki Oct 26 '15 at 14:31
  • @Tunaki, But this is possible in case of war, we can add system scoped dependency in the final war. Why not possible with the jar? – Reena Upadhyay Oct 26 '15 at 14:31
  • There is no sense in closing a question as this is a valid question, if something is supported by maven in war, there might be some alternate to make it part of jar as well. I already have gone through the link which you have pointed in the first comment, but I have said in my question, I have some system dependency, I don't want it to be part of local file system repo, as making it part of local file system repo, would require to execute mvn install:install-file command from outside the project, But in my case my project jar is getting build by CI jenkins server. – Reena Upadhyay Oct 26 '15 at 14:41
  • As I said before, this absolutely will not work on a war. The `system` scope is not what you are looking for. You should have a private internal repository like Nexus or Artifactory and upload this specific artifact to this repo (FYI, my first comment links to 7 differents questions, and that was only Google first page, I could add more). – Tunaki Oct 26 '15 at 14:43
  • org.apache.maven.plugins maven-war-plugin 2.1.1 dependencies/mydep WEB-INF/lib true **/*.jar – Reena Upadhyay Oct 26 '15 at 14:49
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/93375/discussion-between-reena-upadhyay-and-tunaki). – Reena Upadhyay Oct 26 '15 at 14:49

0 Answers0