-1

I have some dependencies (jars) which I need to make part of my pom.xml file in such a way that when mvn package is executed, non-maven dependencies are also resolved as dependencies for my project. Let's say all this needs to happen in a Continuous Integration environment.

Mayank Gupta
  • 31
  • 10
  • Maybe [this](https://stackoverflow.com/questions/1164043/maven-how-to-include-jars-which-are-not-available-in-reps-into-a-j2ee-project) other question can help. – Federico klez Culloca May 16 '18 at 09:48
  • Install a repository manager and install the dependency in the repo manager which works for your local machine as well as for the CI ... – khmarbaise May 16 '18 at 09:52
  • 1
    In the long run you will be happier with having these jars as real dependencies. Check if somebody else already pushed them to Maven Central (repackaged or someting). – Thorbjørn Ravn Andersen May 16 '18 at 09:57
  • Fro some reason, I could not put the jar into the mven repo (neither global nor local). Placed the jar into the project lib and used system scope to use the jar; limitation is with this approach the jar is not packaged into war by Maven. Finally found another way, use project lib as a local repo: project-repo file://${project.basedir}/src/lib With this approach the jars can be used just like any other maven dependency and they are packaged into the war too. – Mayank Gupta May 29 '18 at 06:25

1 Answers1

1

As others have suggested in the comments. You should find a way to only use maven dependencies. If the jars you need are not in any public maven repository, create your own maven repository to host them so that the build is repeatable for others on your team.

With that said, if you absolutely need to use non-maven dependencies, you can use the system scope when specifying the dependency in your pom. See examples and docs here:

https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies

Just make up the groupId, artifact, and version when using the system scope.

ilooner
  • 2,480
  • 15
  • 32