Thomas Sundberg

June 10, 2011

Install a 3:rd part lib in Maven

Filed under: Automation, Maven — Tags: — Thomas Sundberg @ 13:27

This post has been migrated to

Suppose that you have a dependency that looks something like this:


that can’t be resolved and the build fails with the error message below:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project regression: Could not resolve dependencies for project se.sigma.eduational:example:jar:1.0:
Could not find artifact foo:bar:jar:1.0-SNAPSHOT in Sigma Internal Repository (http://mavenrepo:8080/archiva/repository/internal/) -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

To upload the missing jar manually, do like this:

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

A real world example could be

mvn install:install-file -Dfile=C:\temp\myThirdPartLib.jar -DgroupId=foo -DartifactId=bar -Dversion=1.0 -Dpackaging=jar

Running it could look something like this:

C:\example>mvn install:install-file -Dfile=C:\temp\myThirdPartLib.jar -DgroupId=foo -DartifactId=bar -Dversion=1.0 -Dpackaging=jar
[INFO] Scanning for projects...
[INFO] ------------------------------
[INFO] Building Example 1.0
[INFO] ------------------------------
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ regression ---
[INFO] Installing C:\temp\myThirdPartLib.jar to C:\java\maven-repository\foo\bar\1.0\bar-1.0.jar
[INFO] Installing C:\DOCUME~1\exttiy\LOKALA~1\Temp\mvninstall1957897313833162867.pom to C:\java\maven-repository\foo\bar\1.0\bar-1.0.pom
[INFO] ------------------------------
[INFO] ------------------------------
[INFO] Total time: 0.390s
[INFO] Finished at: Wed Feb 16 11:22:00 CET 2011
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------

Re-run your build with the third party lib installed.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: