Running Eclipse project with maven dependency to another project in same workspace? - eclipse

In my workspace i have many maven projects with dependecies between them managed by maven.
When i try to navigate through the types it shows the maven installed artifact and not the actual class in the workspace residing in another project.
It will be of much help if eclipse autoresolves the maven dependency and point to the local project instead of installed artifact. Is there any we can force that.
Thanks

Related

Connect project via local maven (in Eclipse)

In Eclipse, I can create dependency project and refer it from Projects tab from Java Build Path dialog.
May I substitute this with something "mavenish"?
For example, may be I can post maven project to local repository and then refer it by maven coordinates as usually in pom.xml?
Yes you could install it to your local maven repository (mvn install). But it also works if you just have the project in your workspace you don't even have to refer it from Java Build Path as you've mentioned. Just add it as a dependency in your pom and the maven plugin in eclipse will use the dependency from your workspace.

All maven dependencies are shown right in project folder rather than in a maven library in a java project in eclipse

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.

Setting up project is eclipse

I want to setup my work project in Eclipse, with following features:
1) Connect to SVN repository
2) It is a maven - multi module project
3) It is a spring project
If I import this project as Maven project I am not able to connect it to SVN repository.
If I check - out SVN repository, I am not able to set it up as Maven/Spring project.
And ideally I want to make it hot deployable, (as eclipse dynamic web project), so Development can be efficient.
How can I possibly do this.
I have setup eclipse Juno SR1 with Maven, STS, and SVN plugins.
What you can do is follow the below steps :-
Checkout from svn to your local drive.
As it is a mave nbuild project you will have the pom.xml file in the root of the project. Do a mvn eclipse:eclipse -Dwtpversion=2.0 on the project.
3.Open eclipse and go to File-->Import--> Existing projects into workspace.
This should do.
FYR see this
After the project is checked out into the Eclipse workspace, just remove the project by using the following action: -
right click at the project ---> delete ---> click ok
Please take a note, do not check the check box named "Delete project content on disk". We have just want to remove and re-import again.
All we need to do is re-importing by using the following action: -
File ---> Import ---> Maven ---> Existing Maven projects
This will help us to integrate the Maven with the SVN in Eclipse. We will see the revision information after the project name, folders, packages, classes, etc.
Anyhow to use Maven in the Eclipse, you should install the Maven Integration (m2e). Furthermore there is a useful plug-in to integrate the Eclipse WTP with the Maven as well. It is named Maven Integration for WTP.
I hope this may help.

Eclipse Indigo with m2e can't find maven dependencies in a multi-module project

I've created a multi-module project using Indigo with m2e 1.0. One of the child modules has a dependency on the other. It all builds correctly under maven.
Eclipse, however, can't find any of the classes that this module uses from the dependency .jar. The project properties shows the artifact under Maven Dependencies, but it does not show the actual .jar file itself.
I added the dependency with the Maven menu for this project.
The .project and .classpath got generated automagically at some point. I did not have to run mvn eclipse:eclipse or mvn eclipse:m2e (or whatever the goal is for m2e). The .classpath doesn't have the dependent .jar in it, but it does have org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER.
I've tried all the options under the Maven menu (update dependencies, update configuration) and refreshing the project. I've closed and re-opened Eclipse. It still shows errors.
This makes Eclipse worthless as a Java editor in multi-module projects. I could manually add the dependency .jar in the .classpath, but this defeats the purpose of integration Eclipse and Maven with m2e.
Is there any solution for this in Eclipse?
Thanks.
The answer turned out to be the last answer to this question given by Jody Box. It's pretty bizzare that in order for Eclipse to resolve dependencies from another project in the Workspace that you have to uncheck the "Resolve dependencies from Workspace projects" checkbox.
I know mvn can be convoluted but this checkbox is doing the opposite of what it says.

How to clone Hibernate sources using Egit (Eclipse)?

I need help using Egit (Eclipse git integration capabilities). My goal is to have Hibernate sources in my local Eclipse. Eventually I aim for running their tests, doing some changes in the sources, issuing a git pull request (patch), etc.
Can someone explain how to clone Hibernate sources and have them as Java Project(s) in Eclipse?
All I can achieve myself is to have the sources cloned (as needed) to some specified path (the suggested path is outside of the workspace directory). Then I am puzzled trying to convert the structure into Java projects in Eclipse. I try different ways to import the project(s) using File | Import (e.g. Existing projects into workspace) or linking sources into a new created Java project. The problem seems to be the Hibernate sources are not a single maven project (not quite sure about this one either, I am new to maven) and probably not an Eclipse project at all, so Eclipse doesn't recognize the source structure at all.
It looks like it has both maven and ant builds, so you can generate Eclipse projects with both of these.
For maven you have 2 options:
Run mvn eclipse:eclipse to generate
eclipse project artifacts and then
import existing projects.
Install m2Eclipse and import Existing Maven
Project. This is the preferred
approach when working with Maven and
Eclipse.
For ant, New project->Java Project from Existing Ant Buildfile