I have dependancies 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 instance. Is there any way to force m2eclipse to use the local maven installation in osx?
我在我的机器上安装了本地设备(~/.m2/库/blah/blah/blah /blah),而m2eclipse并没有识别它们——我认为m2eclipse正在使用它自己的maven实例。是否有办法强制m2eclipse在osx中使用本地maven安装?
5 个解决方案
#1
24
I had the same problem, and this is what worked for me. Using Eclipse Indigo:
我有同样的问题,这就是我的工作。使用Eclipse Indigo:
Windows->Show View->Other
窗口- >显示视图- >其他
In the pop-up: Maven->Maven Repositories
在弹出式中:Maven->Maven存储库。
Once the view is displayed, right click on the appropriate repo, and select "Rebuild Index"
显示视图后,右键单击相应的repo,并选择“重构索引”
Wait a few seconds and done!
等几秒钟再做!
#2
5
I have dependencies installed local on my machine (~/.m2/repository/blah/blah/blah) and m2eclipse is not recognizing them as there.
我在我的机器上安装了本地的依赖项(~/.m2/库/blah/blah/blah /blah/blah),而m2eclipse并没有在那里识别它们。
Do they have good metadata? How did you install them? Because m2eclipse definitely uses your local repository for dependency resolution.
他们有好的元数据吗?你是怎么安装的?因为m2eclipse肯定使用本地存储库进行依赖项解析。
I think m2eclipse is using its own maven instance. Is there any way to force m2eclipse to use the local maven installation in osx?
我认为m2eclipse正在使用它自己的maven实例。是否有办法强制m2eclipse在osx中使用本地maven安装?
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:
是的,m2eclipse默认使用它自己的版本的Maven,您可以添加一个外部安装通过Window > Preferences > Maven >安装但这不会改变任何本地存储库所使用的一个或另一个,您可以配置通过Window > Preferences > Maven >用户设置如下所示:
alt text http://www.imagebanana.com/img/w5y2vevt/screenshot_008.png
alt文本http://www.imagebanana.com/img/w5y2vevt/screenshot_008.png
This send us back to the questions above: how did you "install" the problematic dependencies?
这让我们回到上面的问题:您是如何“安装”有问题的依赖项的?
#3
2
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.
您可以在Windows->首选项->Maven->安装中更改使用的Maven实例。但是,我不确定这是否有助于在该设置下的评论中说,依赖项解析仍然可以通过内部Maven安装完成。
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).
如果我是您,我将尝试将本地存储库添加到已知存储库的列表中。使用窗口->显示视图->Maven存储库(这在首选项中是不可见的)。
#4
0
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.
检查jar是否安装正确。当您在安装到本地存储库时为jar提供错误的路径时,Maven不会给出错误。jgravatar。当我运行下面的命令时,jar不在我的~目录中。
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] ------------------------------------------------------------------------
#5
0
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.
我也得到了同样的问题。我通过安装文件命令将jar添加到本地存储库中。我核实他们已经安装好了。我重建索引。我使用7Zip访问了这个目录并检查了JAR文件,但是我无法让它出现在我的eclipse项目中的Maven依赖项中。
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:
对我来说,解决办法是相当愚蠢的。当我在pom中添加依赖项时。使用依赖关系编辑器的xml, Maven将一个打包节放入xml中。XML条目是这样的:
<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.
一切都工作得很好。
#1
24
I had the same problem, and this is what worked for me. Using Eclipse Indigo:
我有同样的问题,这就是我的工作。使用Eclipse Indigo:
Windows->Show View->Other
窗口- >显示视图- >其他
In the pop-up: Maven->Maven Repositories
在弹出式中:Maven->Maven存储库。
Once the view is displayed, right click on the appropriate repo, and select "Rebuild Index"
显示视图后,右键单击相应的repo,并选择“重构索引”
Wait a few seconds and done!
等几秒钟再做!
#2
5
I have dependencies installed local on my machine (~/.m2/repository/blah/blah/blah) and m2eclipse is not recognizing them as there.
我在我的机器上安装了本地的依赖项(~/.m2/库/blah/blah/blah /blah/blah),而m2eclipse并没有在那里识别它们。
Do they have good metadata? How did you install them? Because m2eclipse definitely uses your local repository for dependency resolution.
他们有好的元数据吗?你是怎么安装的?因为m2eclipse肯定使用本地存储库进行依赖项解析。
I think m2eclipse is using its own maven instance. Is there any way to force m2eclipse to use the local maven installation in osx?
我认为m2eclipse正在使用它自己的maven实例。是否有办法强制m2eclipse在osx中使用本地maven安装?
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:
是的,m2eclipse默认使用它自己的版本的Maven,您可以添加一个外部安装通过Window > Preferences > Maven >安装但这不会改变任何本地存储库所使用的一个或另一个,您可以配置通过Window > Preferences > Maven >用户设置如下所示:
alt text http://www.imagebanana.com/img/w5y2vevt/screenshot_008.png
alt文本http://www.imagebanana.com/img/w5y2vevt/screenshot_008.png
This send us back to the questions above: how did you "install" the problematic dependencies?
这让我们回到上面的问题:您是如何“安装”有问题的依赖项的?
#3
2
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.
您可以在Windows->首选项->Maven->安装中更改使用的Maven实例。但是,我不确定这是否有助于在该设置下的评论中说,依赖项解析仍然可以通过内部Maven安装完成。
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).
如果我是您,我将尝试将本地存储库添加到已知存储库的列表中。使用窗口->显示视图->Maven存储库(这在首选项中是不可见的)。
#4
0
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.
检查jar是否安装正确。当您在安装到本地存储库时为jar提供错误的路径时,Maven不会给出错误。jgravatar。当我运行下面的命令时,jar不在我的~目录中。
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] ------------------------------------------------------------------------
#5
0
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.
我也得到了同样的问题。我通过安装文件命令将jar添加到本地存储库中。我核实他们已经安装好了。我重建索引。我使用7Zip访问了这个目录并检查了JAR文件,但是我无法让它出现在我的eclipse项目中的Maven依赖项中。
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:
对我来说,解决办法是相当愚蠢的。当我在pom中添加依赖项时。使用依赖关系编辑器的xml, Maven将一个打包节放入xml中。XML条目是这样的:
<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.
一切都工作得很好。