Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

How to add existing jars using maven...

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am new to maven. I am trying to change my existing project(using ant previously) to maven. I facing a problem adding my existing jars to the project. I have learnt from the internet that to do this, i have 2 options

1. Intalling the dependencies from the repository.
2. Add to the local repository (file by file) using
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

I dont want to install a huge number of files from the repository, so tried
second option but its really hard for me to install each jar file one by one. Is there any better option or something to automate this task ? Please help.

Thanks in advance,
P R A V E E N
 
Saloon Keeper
Posts: 21441
143
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you're only trying to add your own jars, since Maven will automatically cache stuff as you use it - you don't have to manually install the public library jars.

What I'd do is make up a spreadsheet, one jar per row, with the columns containing the packaging info, export the spreadsheet to text and build a script that would take that text and substitute the data into maven commands, then execute those commands. Which is simpler than it sounds.

A real VBA geek might actually write an Excel macro to generate the maven commands out to a text file, but the end result is the same.
 
Try 100 things. 2 will work out, but you will never know in advance which 2. This tiny ad might be one:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!