views:

1856

answers:

3

I'm using m2eclipse as my maven 2 plugin for eclipse. I'm brand new to maven, so my mistake might be simple, although searching has not yielded any solutions for me. I can run maven from the command line and it build successfully. However if I import as an existing maven project, or use mvn eclipse:eclipse and then import I get the artifacts not found in my POM file resulting in no maven dependencies being loaded at all.

What's odd is that I have 2 projects, both children to a parent pom packaged project. One child loads all my maven dependencies while the other cannot find any and says my pom file is missing artifacts. Again, I can install and package them all just fine from the command line.

I even tried loading my projects into netbeans which worked flawlessly, however I am required to use eclipse.

Any ideas on how to fix this?

Update

Directory structure, pom files layout:

--main
  --pom.xml   (is a pom package that is the parent to two other projects)
  --ProjectA
    --pom.xml
  --ProjectB
    --pom.xml

Main is the parent project of both ProjectA and ProjectB. ProjectB has ProjectA as a dependency. Apprently m2eclipse is not happy about that depedency. As soon as I remove the dependency of ProjectA from ProjectB's pom file all the maven dependencies are found by eclipse.

- com.company.myproj:app:6.6.0:jar Missing: ---------- 1) com.company.myproj:main:pom:${myproj.version} ---------- 1 required artifact is missing. for artifact: com.company.myproj:main:pom:$
 {myproj.version} from the specified remote repositories: apache-incubating (http://people.apache.org/repo/m2-incubating-repository/, releases=true, snapshots=true), central (http://
 repo1.maven.org/maven2, releases=true, snapshots=false)

However, I still need ProjectB to have that dependency for ProjectA. The error message seems to be m2eclipse looking for ProjectA in a remote repo. Project A should only be in .m2 directory, but I'm not sure how to tell m2eclipse to look there.

I think this may be just a m2eclipse specific issue because using mvn from the command line works fine and like I said previously, netbeans loads the projects and dependencies just fine.

A: 

I had problems with using m2eclipse (i.e. it did not appear to be installed at all) but I develop a project using IAM - maven plugin for eclipse supported by Eclipse Foundation (or hosted or something like that).

I had sometimes problems as sometimes some strange error appeared for project (it couldn't move something) but simple command (run from eclipse as task or from console) + refresh (F5) solved all problems:

mvn clean

However please note that I created project in eclipse. However I modified pom.xml by hand.

Maciej Piechotka
+1  A: 

It sounds like your m2eclipse install is using the embedded Maven, which has its own repository (located under user home) and settings.

If you open up the Maven preferences (Window->Preferences->Maven->Installations, you can add your Maven installation by selecting Add... then browsing to the M2_HOME directory.

Preferences screenshot

For more details see the m2eclipse book

Rich Seller
Hi Rich! I'm not sure to get your point. By default, the embedded maven uses the same "default" local repository location (`~/.m2/repository`) than an external maven install. Plus, the embedded version is always used for dependency resolution (as mentioned in the note) so adding an external maven install won't change anything here IMHO.
Pascal Thivent
@Pascal I see this same problem at work where the Maven settings standards dictate a different local repository and proxy settings are needed for external repositories. I'm guessing the OP has a similar situation in which case using the same settings.xml will resolve it
Rich Seller
Thanks for this tip. I didn't know you could specify this... though I'm still experiencing my problem it has helped my better understand how to use m2eclipse and maven.
vagabond
A: 

I'm experiencing problems while trying to import OpenEMPI into Eclipse. The project build fine from command line. So every artifact and needed dependency should be in ~/.m2/repository. m2eclipse seems to not find/see my local repository, I get thousands of missing artifact errors. I wiped out Eclipse, the repository itself, the project source, but it didn't help. Any help would be appreciated. My system: Windows 7 x64, SUN JDK 1.6.0_19 x64, External Maven installation 2.2.1, Eclipse 3.5.2, m2eclipse 0.10.? (newest from the update site)

Csaba Toth
It seems that somehow m2eclipse 0.10 cannot do the resource filtering well. In my error logs it seemingly cannot resolve properties like ${release.version}. Somebody mentioned that even if I specify external Maven for m2eclipse, it uses it's own embedded 3.0 Maven snapshot to resolve things, maybe that's the root cause of the problem? I don't know what's going on under the hood, it just doesn't work
Csaba Toth
I tried IAM also, but it's not 100% either.
Csaba Toth
My struggles:http://kenai.com/projects/openempi/forums/developer-forum/topics/2746-Help-with-importing-OpenEMPI-into-Eclipse
Csaba Toth