Program-Me-Rev
Program-Me-Rev

Reputation: 6624

How to add dependencies to a project via maven from downloaded zip (extracted) files

I have a project that I worked on from NetBeans. It uses a number of frameworks, such as Hibernate and JFXtras. I was working from NetBeans, whereby, I would manually add the framework liblaries, that is, download their arch-hive files(zips), extract them and add them to my class paths via NetBeans.

I now want to do all this via Maven.

The problem is that my internet is crazy slow and expensive. Hibernate is particularly quite large to include add via maven from where I'm located. I have a copy of the Hibernate zip file I had downloaded.

Is there a way I could tell maven something like: "I have Hibernate in my hard drive, so please find it in this..?? folder, located here: just follow this /path/..."

This way I would not have maven go online to get the Hibernate, JFXtras, etc, etc dependency files?

Upvotes: 0

Views: 83

Answers (1)

sendon1982
sendon1982

Reputation: 11234

The location of your local repository can be changed in your user configuration. The default value is ${user.home}/.m2/repository/.

<settings>
    <localRepository>/path/to/local/repo/</localRepository>
</settings>

Then run command below to install your jar files into local repo:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

So next time when running maven, it will try to get dependent jar files from local, if it is not there, then get from remote.

Upvotes: 1

Related Questions