I have modular maven project which I firstly imported to eclipse as regular maven project (import => maven => existing maven project). This does not work correctly for our project (many errors etc.).
So I decided to remove this project from eclipse and import it again but as general project (use mvn eclipse:eclipse to generate eclipse project files and then import => general => existing projects into workspace).
But, even when I imported it as general project, Eclipse still import it as maven project (small M icon next to project name in package explorer). What I tried before importing (without success):
remove .settings directory from each maven module
remove .project file from each maven module
Do you know how to solve this problem? How can I import maven project as general project when it was before imported as maven project?
One solution I found is to disable Maven nature of project.
Projects which was imported as Maven project can be "converted" back to "general" project by project context menu => Maven => Disable Maven Nature
Related
I have a (command-line) maven based project which just works great (mvn clean, mvn verify, install all perfect)! I want now import this into eclipse not as maven project but regular eclipse project.
I did it but I have a dependency issue which I solved by just copying all the jars created into the .m2 folder to another folder into my eclipse workspace. Then I've added all these jars to my project.
everything ok!
Question is: I have the feeling that this is not the best way to manage the dependency in eclipse ... what do you suggest? best practices
If you have a simple java project which is made up of only one module, using Eclipse is very simple. To generate the Eclipse project files from your POM you execute the following command:
mvn eclipse:eclipse
If you have created or checked out the project with Eclipse, you only have to refresh the project in your workspace. Otherwise you have to import the project into your Eclipse workspace (From the menu bar, select File > Import > Existing Projects into Workspace). In the latter case the project (directory) should not be located in your workspace, because Eclipse might come into trouble, especially if you want to use Eclipse as the scm client.
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
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'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.
I import a project into eclipse from svn and then go and run 'mvn install' from the command line and everything compiles fine. But I don't understand why the code is not compiled in Eclipse too.
From my previous experience I know that I need to go ahead in Eclipse and import "existing maven projects" to have Eclipse compile the code, I just don't understand why.
Thanks!
How have you imported the projects to Eclipse? By runnint mvn eclipse:eclipse to import them as 'Java project' or importing the maven projects directly with the m2eclipse plugin?
By default maven builds each project into a directory target in each project whereas Eclipse builds into eclipse-out. mvn install builds each maven project to create an archive (jar, war, ear etc) whereas Eclipse needs to build to be able to run the code in Eclipse.