Jul 26th, 2010, 12:02 PM
1.1.0.M2 "dep add" on project already imported into Eclipse doesn't update build path
I downloaded 1.1.0.M2 and created a new project, setup persistence and then imported it into Eclipse. I added a dependency to an artifact that only exists in my local repository. For some reason, the project in Eclipse doesn't seem to pick it up even after refreshing, although the new dependency resolved successfully. I've attempted closing the project in Eclipse and even removing it from my workspace, both followed by running "perform eclipse" back in the stand alone roo shell or simply "perform command --mavenCommand dependency:resolve". Upon reopening or reimporting the project, the build path still wasn't updated to include the artifact I added a dependency for. If I look in my pom.xml, the dependency is indeed listed there.
Anybody else experience this?
In previous testing, I had a similar issue. If I first completed the persistence setup say using provider DATANUCLEUS, after performing various other commands, if I then reran the persistence setup and changed the provider to HIBERNATE, the build path in Eclipse still referenced Data Nucleus artifacts, even the Data Nucleus repository remained in my pom.xml.
Jul 26th, 2010, 12:43 PM
Further investigation seems to tell me that if the project I'm importing into Eclipse has a dependency on a local repo artifact that just happens to also be in the same workspace I'm importing the project into but the other project is closed, then it does add it to the build path but it's looking for the one in the local workspace rather than the one in the local maven repository. Since the project is closed, it can't find it.
Last edited by pgrimard; Jul 26th, 2010 at 12:47 PM.
Jul 26th, 2010, 02:38 PM
I believe you are seeing a side-effect of an m2eclipse feature. To stop it from trying to resolve dependencies from your workspace, go to the properties for that project and under 'Maven', uncheck 'Resolve dependencies from Workspace project'.
Jul 26th, 2010, 02:59 PM
Actually, I don't even have Maven dependency management enabled for this project. After having created it in Roo, I imported it into Eclipse simply by selecting "import existing project into workspace" under General, so it by default did not turn on maven dependency management. So m2eclipse shouldn't be doing anything.
Jul 27th, 2010, 12:03 PM
Suresk you were right. Although I did not want to turn on maven dependency management in Eclipse for my project, I pretty much had no choice if I wanted it to stop resolving against the workspace. So I enabled dependency management and did as you suggested by unchecking "Resolve dependencies from Workspace projects." Now it resolved my artifact from the local repository. I wish there was a better way to do it then having to turn on maven for the project.