Eclipse m2eclipse getting dependencies from local repository

前端 未结 5 1886
眼角桃花
眼角桃花 2021-02-07 13:49

I have dependencies installed local on my machine (~/.m2/repository/blah/blah/blah) and m2eclipse is not recognizing them as there - I think m2eclipse is using its own maven ins

相关标签:
5条回答
  • 2021-02-07 13:54

    You can change the used Maven instance in Windows->Preferences->Maven->Installations. But I'm not sure whether this will help as a comment below that setting says that dependency resolution will still be done with the internal Maven installation.

    If I were you, I would try to add that local repository to the list of known repositories. Use Window->Show View->Maven repositories (this is sadly not visible in the preferences).

    0 讨论(0)
  • 2021-02-07 14:05

    Check that the jar was installed properly. Maven does not give an error when you provide an incorrect path to the jar when installing to local repository. The jgravatar.jar was not in my ~ directory when I ran the command below.

    mvn install:install-file -Dfile=~/jgravatar.jar -DgroupId=jgravatar -DartifactId=jgravatar -Dversion=06292012 -Dpackaging=jar
    
    [INFO] Installing /Users/steve/~/jgravatar.jar to /Users/steve/.m2/repository/jgravatar/jgravatar/06292012/jgravatar-06292012.jar
    [INFO] Installing /var/folders/gz/gjyqtkzj3ys8lpmh_38qvmn00000gq/T/mvninstall2662938607942511865.pom to /Users/steve/.m2/repository/jgravatar/jgravatar/06292012/jgravatar-06292012.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    
    0 讨论(0)
  • 2021-02-07 14:09

    I had the same problem, and this is what worked for me. Using Eclipse Indigo:

    Windows->Show View->Other

    In the pop-up: Maven->Maven Repositories

    Once the view is displayed, right click on the appropriate repo, and select "Rebuild Index"

    Wait a few seconds and done!

    0 讨论(0)
  • 2021-02-07 14:10

    I was getting the exact same issue. I added the JARs to the local repository via the install-file command. I verified they were installed. I rebuilt the index. I went to the directory and inspected the JAR file using 7Zip, but I could not get it to appear in the Maven Dependencies inside of my eclipse project.

    For me the solution was pretty silly. When I added the dependency into the pom.xml using the dependencies editor, Maven threw in a packaging stanza into the XML. So the XML entry looked like:

        <dependency>
            <groupId>slf4j</groupId>
            <artifactId>jdk14</artifactId>
            <version>1.5.8</version>
            <type>JAR</type>
        </dependency>
    

    When I removed the last stanza "JAR" and made the entry:

        <dependency>
            <groupId>slf4j</groupId>
            <artifactId>jdk14</artifactId>
            <version>1.5.8</version>
        </dependency>
    

    it all worked fine.

    0 讨论(0)
  • 2021-02-07 14:11

    I have dependencies installed local on my machine (~/.m2/repository/blah/blah/blah) and m2eclipse is not recognizing them as there.

    Do they have good metadata? How did you install them? Because m2eclipse definitely uses your local repository for dependency resolution.

    I think m2eclipse is using its own maven instance. Is there any way to force m2eclipse to use the local maven installation in osx?

    Yes, m2eclipse uses its own version of Maven by default and you can add an external installation via Window > Preferences > Maven > Installations but this won't change anything to the local repository used by one or the other that you can configure via Window > Preferences > Maven > User Settings as shown below:

    alt text http://www.imagebanana.com/img/w5y2vevt/screenshot_008.png

    This send us back to the questions above: how did you "install" the problematic dependencies?

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