1

I have 50 jars that I need to add to a Maven project as dependencies. They are not in the public repository, I cannot install a local repository and I'd like to know a quick solution to add them in my pom.xml.

I know that to add a local dependency you could write

<dependency>
  <groupId>sample</groupId>
  <artifactId>com.sample</artifactId>
  <version>1.0</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/src/main/resources/yourJar.jar</systemPath>
</dependency>

but this is simply a real long task with several Jars. Is there an easy way to do it?

The solutions suggested in How to add local jar files in maven project? are specific for a single or few Jars but not the case when you many of them.

Community
  • 1
  • 1
Luca S.
  • 1,132
  • 2
  • 16
  • 31
  • Start using a repository manager and install them there and use them as dependencies that's it... – khmarbaise Mar 17 '16 at 14:06
  • I am using a corporate workstation where I am not allowed to install a repository manager. The only solution that I found so far is to write my own script to generate the ......code. – Luca S. Mar 17 '16 at 14:13
  • Could you please share your solution, I have same usecase. – Ana Nov 26 '20 at 06:48

1 Answers1

-1

Add those jars to your local maven repository and then add their dependency to your POM. See this link: MKYong: How to include custom library into maven local repository?

Arka Ghosh
  • 845
  • 1
  • 11
  • 23
  • "I cannot install a local repository" – Luca S. Mar 17 '16 at 13:55
  • 2
    @LucaS. All maven installations include a local repository. That's how maven *works*. If you have maven, you have a local repository already, and you can already install artifacts into it. – Ian McLaird Mar 17 '16 at 14:24