I have two components with own maven dependencies combined into one enterprise project. It is built/deployed/run normally, but Eclipse can't resolve maven dependencies. Project is turned to be maven, and "use maven dependency management" option is enabled. However Eclipse gives me compilation errors.
What should I do to solve the problem?
Check if the maven dependencies are included in the classpath and add if it is not there.
Right click on project -> Properties -> Build Path -> Libraries ->
Add Library -> Maven Managed Dependencies
After that you may also need to
Select Project -> From top menu -> Project -> Clean and build if auto build is not enabled
Actually the problem was about the version of m2eclipse plugin.
Good plugin can be downloaded here:
http://m2eclipse.sonatype.org/sites/archives/m2e-0.10.2.20100623-1649/
Related
I imported one project form a git repository. I imported it as a Java project and the project has many maven dependencies.
After I executed maven install all the dependencies are showing under the project menu, but for other who checked out the project all the dependencies are showing in a maven library in the project.
We checked out the code from the same repository and we have the same settings for maven installed in our computers. What could went wrong in here? I checked the maven settings in eclipse and the setting.xml file and they are both identical (except some path names which differ on different machines.)
Right click over the project > Configure > Convert to Maven project. It should be displayed correctly, after this.
I am utilizing the standard maven directory layout in my eclipse maven project:
src/main/java
src/main/assembly
src/main/config
src/main/scripts
src/main/resources
src/test/java
src/test/resources
as per the: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Whenever I then use 'Maven -> Update Project Configuration' in the m2e plugin the 'assembly', 'config' and 'scripts' directories are being removed by m2e from source folders. I would appreciate if anyone could suggest how to configure m2e to respect the standard maven layout. I used the basic java archetype offered by m2e to create the project.
With the maven-build-helper plugin you can add additional source folders to your build. To make eclipse extract that information from the plugin you need the m2e connectors buildhelper and m2e-apt. They can be found on the marketplace.
I recently upgraded my Eclipse to Juno and am struggling with the way maven dependencies are handled.
I installed the m2e plugin. Still, many of my projects started complaining about libraries missing as if the dependencies specified in the pom were completely ignored. This happened despite right-clicking on the project, selecting Configure --> Convert to Maven project, which seems to be the replacement for what used to be "Maven --> Enable dependencies" before. When I looked at the Maven dependencies under the project directory, there were many fewer dependencies listed than in my pom.
Running a maven compile on the command line outside of Eclipse allowed my project to build and after selecting Maven --> Update project, I was able to see the dependencies added or removed accordingly to what I specified in the pom.xml.
Bottom line: maven dependencies seem to work now but I had to do some combination of operations I didn't think should have been needed:
- Configure -> Convert to Maven project
- Maven -> Update dependencies
- Run maven outside of Eclipse
To get everything to work when with previous versions of Eclipse, all I had to do was Maven -> enable dependencies. What is the equivalent of this in Juno, i.e. what is the correct way of setting up juno Eclipse to handle properly a maven project?
I have been using Juno for a while now and the reliable way to solve Maven dependencies from within Eclipse after importing a project that is maven based is simply:
Configure --> Convert to Maven project
Maven --> Update project
Running Maven outside of Eclipse doesn't seem to help.
I am not sure why these two steps are now required when they were not before with previous version of Eclipse (at least, two steps were not needed before for sure).
Running
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
outside of Eclipse has brought me the problems I described in my comment to the other answer.
On a Mac running Windows under Parallels Desktop on OS X? This similar discussion may solve your problem: intellij - java: Cannot find JDK '1.7' for module
I get my code generated from the maven-jaxb2-plugin maven plugin. It puts the code into target/generated-sources. Now I have to manually left click onto the project -> properties-> Java Build Path-> Add Folder.... That's kind of annoying for someone downloading it from SVN.
Is there some way to get that dome automatically through my pom?
This kind of stuff is the responsibility of IDE's Maven plugin and fortunately M2E supports it since recently (finally!) through the concept of M2E connectors, that is M2E extensions that understand a nature and lifecycle binding of certain plugins. And because it's since recently, not much Maven plugins have their connectors for M2E.
However, you're lucky, because Jaxb2 plugins are actually already supported. I assume you're already using M2E. Then go to Preferences -> Maven -> Discovery, then Open Catalog, then find Jaxb2 connector.
maven add-sources should do the trick for netbeans or eclipse
M2E and having maven generated source folders as eclipse source folders
I was trying to run a hibernate sample in eclipse and I am getting
Referenced classpath provider does not exist: org.maven.ide.eclipse.launchconfig.classpathProvider
I just uninstalled maven from eclipse but I think I need to make some changes in configuration to make my program work now.
Thanks,
Sid
If you are no longer using maven eclipse plugin, then you should regenerate your eclipse configuration with
mvn eclipse:clean eclipse:eclipse
This will make available all the project dependencies to eclipse.
I just had this problem from some old maven settings; it was stuck between maven nature and default.
You can right click the project -> Configure -> Convert to Maven Project. Now that you have the maven option you can do right click project -> Maven -> Disable Maven Nature.
This got it unstuck for me, but you could also manually fix it in the .classpath file.
You need to clean your workspace. Projects -> Clean...