How to add external jar files to Maven project POM

Maven has made compiling Java projects almost an effortless job. You no longer need to worry about placing all the required class files in your classpath. All you have to do is to include dependencies in your POM file and Maven takes care of the rest. It automatically downloads the jar file that your project depends on and include them in your build classpath. But what if you want to include a jar file that is not available from Maven repositories? To include such jar files you will have to manually install the jar into your local maven repository. Let say you need Oracle driver which is included in ojdbc14.jar. Download the jar file from Oracle and then execute following command.

C:\>mvn install:install-file -Dfile=ojdbc14.jar -DartifactId=ojdbc14 -Dversion=10.2.0 -Dpackaging=jar

Then add this dependency to your project POM file.


Now when you build your project ojdb14.jar will be available.

You can follow the same steps for your own jar files. For example if you have created a jar file (e.g. utils.jar) of helper classes and need that jar file in some other project you will first install the jar to your repository and then add the dependency in your POM file.

C:\>mvn install:install-file -Dfile=utils.jar -DgroupId=com.zparacha.example -DartifactId=utils -Dversion=1.0 -Dpackaging=jar

And the dependency for your POM will be like


And all the class files will become available to your project.

9 years ago


  1. I have one problem,

    I have followed the steps as above
    But when I am trying to install maven ..the below error came
    [INFO] Unable to find resource ‘’ in repository org.springframework.maven.milestone (
    [INFO] Unable to find resource ‘’ in repository mrepo-happyfern-snapshot (
    [INFO] Unable to find resource ‘’ in repository central (
    [INFO] ————————————————————————
    [INFO] ————————————————————————
    [INFO] Failed to resolve artifact.


    Since my custom jar file is not available in maven repository Its giving error
    Any help is appreciated

  2. Maven is useful when you are setting up project and it stops right there

    For two days I am trying to convince maven to automate project deployment so I could simply run excutable jar. I cannot, because it cannot find external JARs because they are not there.

    I hate using external tools that use external tools that use external tools that use external tools to build one simple f…ing project with maven.

  3. Hey buddies,

    Maven is quite powerful if you have a lots of libraries.
    It;s not only about the library, but the other powerful features to customize the build process to a great extent.

    In case when this error comes “Failed to resolve artifact.” Please see that you may have to add a repository in your pom.xml; or as an option, manually install the jar files into the local maven repository as per the article.

    Or you can still be with managing libraries, the old school way, add library and manage them in a directory lol ! Actually, if you are doing a small project like assignment or something, maven is not suitable for the environment.

  4. If the amount of external jar files is large, it may be painful to install each of them to the repository manually.
    The addjars-maven-plugin can handle this problem: it automatically installs the jar files to local repository and adds the corresponding artifacts to the list of dependencies. Refer to for more information

Leave a Reply

Your email address will not be published. Required fields are marked *