How to work with a `.jar` file in your local maven setup : Add, Install, Use dependency

preview_player
Показать описание
Sometimes you want to work with a jar file that isn't hosted in maven central. It might be a 3rd party jar, it might be one that you have written.

I explain the following options:

- add .jar files as an IntelliJ project dependency
- install it locally to your .m2 repository
- add it to your project as a system scoped file
- use a repository management tool like Nexus or Archiva
- publish the dependency to maven central

*************

*************

►► Contact Details:

Read my writing and blogs at:

Follow me on social media:

*************

►► Read my books

★ "Dear Evil Tester" - explore the tester's mind
★ "Java For Testers" - learn to code in Java
★ "Automating and Testing a REST API - a case study"

*************

►►Learn skills from my online training courses

★ Selenium WebDriver With Java
★ Technical Web Testing 101
★ Evil Tester Talks Technical Testing
★ Case Study: Java Desktop Application Technical Training

*************
Рекомендации по теме
Комментарии
Автор

Thank you so much. Helped me out a lot.

shawnmofid
Автор

What is the install file command different from mvn clean install, it also install it into m2 repo.

leiliu
Автор

Hi Alan,
Have you worked with Gradle instead of Maven on some projects?

It would be great to see some videos on Gradle if you have.
Thanks in advance

Apobothra
Автор

Heyy EvilTester... Can you automate this process of adding a custom jar to local repository through POM ? I mean when I'll build the project it will package as a jar and will go into local .m2?

shubhampaldewar
Автор

How i can include n number of 3rd party jars in war by mvn install at run time without adding in pom and will not provide the name except directory. It should add all jars from a directory like dir: abc, jars: *.jars

itspuneetmeena