Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I manually install a jar to my local Maven repository?

Tags:

maven-2

I'd like to use Google's GXP library in my maven project. I'm new to Maven and having quite a bit of trouble since the .jar is not available in a Maven repository already. From what I've read I should be able to install the jar in my local repository and then make use of it. However, I'm having quite a bit of trouble. Anyone know where I might have gone wrong?

PS C:\Documents and Settings\bmccann\Desktop> mvn install:install-file -Dfile=gxp-0.2.4-beta.jar -DgroupId=com.google -DartifactId=gxp -Dversion=0.2.4-BETA -Dpackaging=jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task '.2.4-beta.jar': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersi
on:goal
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 
like image 828
Ben McCann Avatar asked Dec 09 '09 05:12

Ben McCann


2 Answers

Thanks for the suggestion. I had tried both of those before posting and neither worked. It turns out this wasn't working for me because I was using Windows PowerShell. If I used the standard command console then it worked fine. I guess there's a bug in either PowerShell or Maven that won't let the two interact properly.

like image 174
Ben McCann Avatar answered Oct 12 '22 10:10

Ben McCann


The command you are using is OK. I just copied and pasted it and successfully installed the same freshly downloaded jar in my local repository:

pascal@laptop:~/Downloads$ mvn install:install-file -Dfile=gxp-0.2.4-beta.jar -DgroupId=com.google -DartifactId=gxp -Dversion=0.2.4-BETA -Dpackaging=jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'install'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [install:install-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [install:install-file {execution: default-cli}]
[INFO] Installing /home/pascal/Downloads/gxp-0.2.4-beta.jar to /home/pascal/.m2/repository/com/google/gxp/0.2.4-BETA/gxp-0.2.4-BETA.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Dec 09 08:44:37 CET 2009
[INFO] Final Memory: 3M/53M
[INFO] ------------------------------------------------------------------------

So you must have a problem with the maven-install-plugin plugin (maybe corrupted after an incomplete download). Delete ~/.m2/repository/org/apache/maven/plugins/maven-install-plugin (or even more stuff under ~/.m2/repository/org/apache/maven) and try again.

like image 21
Pascal Thivent Avatar answered Oct 12 '22 09:10

Pascal Thivent