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

后端 未结 2 1364
别那么骄傲
别那么骄傲 2021-01-02 05:05

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 alread

相关标签:
2条回答
  • 2021-01-02 05:06

    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.

    0 讨论(0)
  • 2021-01-02 05:27

    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.

    0 讨论(0)
提交回复
热议问题