Partial import or the Maven existing project in Eclipse Version 2021-03 (4.19.0) - eclipse

I don't understand the behaviour of Eclipse and Maven.
Context
I'm studiyng Vert.x and I'm analyzing this project in marcorotondi github.
I run git clone in my workspace by Git shell.
In the filesystem, there are 4 dir and every dir has his pom.xml.
I run Eclipse.
I run File>Import>Maven>Existing Maven Project.
I check all the 4 Projects and click the "Finish" button.
What I expect to find
I expect to find all the 4 project in my workspace
What I find
I see only 2 projects, the first and last project in alphabetic order (I attach the screen)
If I try to import again the other project, the dialog window shows me the message (I attach the screen)
Project DemoVertx already exists, add a version of custom suffix using
"Name Template" in "Advanced" settings".
Furthermore, I see that in first screenshot the project DemoVertX has the strings
[Vertx master], that is linked to current GIT branch after a clone
(in first), where first is a name of a subdir of the project, but I don't see any parent pom of the project, then the project is not multi-module.
Please, can you give me some explications (or some references) about this?
How I can to import all the 4 projects in the same time?
Thank you a lot

Related

Maven multimodule projects linking in eclipse

I have a maven multi module project which has 5 modules. Some of my modules depend on one or more other modules, I am successfully able build the project and in eclipse also I am not getting any errors. However there is one problem which is bothering me, when i ctrl + click in my code and the class is defined on some other project eclipse does not open the file in the editor. I know i can attach the source code using maven but still i wont be able to make changes to that file.
Is there any way to be able to link projects in eclipse through maven?
Is there any way to be able to link projects in eclipse through maven?
That behaviour is the default. To check if for some reason that default is not in effect for your project, right click your project (the project you want to jump from) and go to "Maven". If there is an option "Disable Workspace Resolution" the workspace resolution is switched on, meaning you can theoretically jump from that project.
If you still cannot jump, then the project you want to jump to is not in your workspace. Take into account that for eclipse to identfy one project as dependency of another, everything including version must match.
Also check what rest_day said. You must have the projects importet as maven projects, but running eclipse:eclipse is not required anymore with current (up to ca 2 year old) eclipse.
Did you import the projects as Maven projects?
Also, could you go to the root of the project and run mvn eclipse:eclipse
eclipse:eclipse
Full name:
org.apache.maven.plugins:maven-eclipse-plugin:2.10:eclipse
Description:
Generates the following eclipse configuration files:
.project and .classpath files
.setting/org.eclipse.jdt.core.prefs with project specific compiler settings various configuration files for WTP (Web Tools Project), if the parameter wtpversion is set to a valid version (WTP configuration is not generated by default)
If this goal is run on
a multiproject root, dependencies between modules will be configured
as direct project dependencies in Eclipse (unless useProjectReferences
is set to false).
Instead of Ctrl+Click, click on the identifier and press F3. If you now see a red text reading "Current text selection cannot be opened in an editor", you've been hit by this bug.
See this question for a solution: How do I get rid of "Current text selection cannot be opened in an editor" in Eclipse?

Subclipse checking out as folder not Java project

I'm trying to import a Java project from my teams subversion repository. So I go through the import GUI for subversion, select my repository and the project, then choose to check it out as a project into the workspace.
However, the project now appears in my workspace simply as a folder:
Trying to add a new class tells me "source folder is not a java project". Is there something I am missing? Thanks.
Check out as a project only does what you want if you have checked-in the Eclipse .project, .classpath files etc. In that scenario those files get checked out and configure the Eclipse project. Otherwise you are just getting an Eclipse "Simple Project" which does not have the Java tools configured.
I assume you do not have those Eclipse files in your repository, so you want to use the other option that lets you run the Eclipse Create Project wizard as part of the checkout. This lets you choose the project type and setup some of the configuration. You can skip most of the configuration since you can also do that after the checkout finishes if you prefer.
See: Subclipse Checkout Documentation

Eclipse apparently picks up all but one projects from Git repository

I have a checked-out version of the Redmine-Mylyn connector open-source project. There are eight Eclipse plug-in projects plus two Eclipse features projects plus .git/ as their sibling in the local file system. It turns out that after importing them as Plug-ins and Fragments (with options Projects with source folders) Eclipse recognizes all plug-in projects but net.sf.redmine_mylyn in the Git repository (i.e. it shows a corresponding suffix next to these project names in its Project Explorer view.)
So net.sf.redmine_mylyn is apparently not recognized with these apparent effects: it has no such suffix in the Project Explorer view and its Team menu list only Apply Patch ... (but no other option related to either Git or sharing). However, if I run git status from the command line e.g. on net.sf.redmine_mylyn/build.properties I can see that it very well also part of the same repository. The Project Explorer does not show the two feature projects at all.
What could be the reason that Eclipse (Kepler) apparently does not recognize one plug-in project in the Git repository and how could I make it do so?
UPDATE
Here is how the .project files are arranged in the file system (output from find . -name .project):
./net.sf.redmine_mylyn/.project
./net.sf.redmine_mylyn.api/.project
./net.sf.redmine_mylyn.api-test/.project
./net.sf.redmine_mylyn.common/.project
./net.sf.redmine_mylyn.core/.project
./net.sf.redmine_mylyn.core-test/.project
./net.sf.redmine_mylyn.core.extension.timesheet_extensions_plugin/.project
./net.sf.redmine_mylyn.extensions.feature/.project
./net.sf.redmine_mylyn.feature/.project
./net.sf.redmine_mylyn.ui/.project
The .project files reference three or four buildCommands (org.eclipse.jdt.core.javabuilder, org.eclipse.pde.ManifestBuilder, org.eclipse.pde.SchemaBuilder, org.eclipse.pde.ds.core.builder)
and two natures (org.eclipse.pde.PluginNature, org.eclipse.jdt.core.javanature). The offending project is one of those which do not reference org.eclipse.pde.ds.core.builder.
And find . -name .git gives:
./.git
Using the usual Import > Existing Projects into Workspace wizard, I could not reproduce the problem. I don't know what Import > Plug-ins and Fragments is supposed to do, but it looks like a bug in there.
I recommend filing a bug for Eclipse PDE and add the link to it here. Be sure to include the specifics such as which repository you used. A high quality bug report contains: A series of steps to reproduce the problem (like you would write in a short tutorial), followed by "this is what I expected to happend" and "this is what actually happened".

Can't run project in Eclipse imported from Git

I have a project in my Eclipse workspace from Github (via File -> Import -> Projects from GIT).
However, I am unable to run the example because the only option I have under "Run As" is "Run Configurations."
After going to "Run Configurations" I click "browse" and the project that I imported from GIT isn't there.
Any ideas?
The question is already answered in the comments but I am providing this answer to possibly clear up some misunderstandings.
In order to recognize a folder as a (Java) project, Eclipse needs to read (or create) a few files for each project, like .project and .classpath. If you do not have them in your project, or do no create them during the import, then Eclipse just imports it as a resource, or a dumb folder.
If your project is tracked by git and is also a maven project, you can clone it locally with Git (command line or GUI tool) and then "Import as existing Maven project" in Eclipse. This will use your pom.xml to create the two files mentioned above and your project will be buildable.
Alternatively, if you have already imported it as you described in your question, you can right click on your project on Package Explorer and choose Configure-->Convert to Maven Project. This will create the .project and allow you to build the project using Maven (right click->Run as..-> Maven build) and Eclipse's incremental builder (where necessary). If your maven project builds an executable, the option to execute it will also be available in the Run as.. menu.
If you have a more complex maven project (like an aggregate pom), and want a Run Configuration that runs a specific program, you will have to write it yourself by opening the Run Configurations window and explicitly referencing the java class.
Don't import the project using git clone. Download it as zip file and extract it. Add it using Project>import> General> Projects from folder and Archive.
Provide path of extracted folder into import source and finish and go to eclipse and clean and build safely run and right click on project and run it.
It should work

How do I import a multi module Maven project from SVN into Eclipse (Indigo) so that child modules can be built independently?

I have tried posting this question on the Eclipse Maven forums but it seems very quiet there so here goes...
My setup:
-Eclipse Indigo Java EE bundle
-m2e
-Subversive
We have a fairly simple multi module maven project on our repo. It has a parent project/pom and 3 child projects/poms.
Steps I am taking to import:
1) I import the project by using "import->import->->Maven->Check out Maven Projects from SCM".
2) On the next dialogue box I select svn as the SCM URL type and enter the rest of the repo URL. I leave the check boxes checked for "Checkout Head Revision" and "Checkout all Projects" and under "advanced" I leave the check box "Resolve Workspace Conflicts" checked too. I do not enter anything under "Profiles" or "Name Template".
3) On the next dialogue box I leave "Use default Workspace location" checked and leave "Add projects(s) to Working set" unchecked and click "finish".
4) I wait a minute or so for the next dialogue box to appear. It asks me to select maven projects and has a file structure as it should be-parent project/pom and 3 child projects/poms with a checkbox beside all 4 items. I have tried to select either just the parent, just the children or all 4 without success.
5) When I select just the parent and uncheck the children above, the project appears to be imported. The parent appears in the project explorer and the three children appear as sub-folders of the parent with each having a pom.
6) If I right click on the parent, I get a Maven item in the context menu and indeed I can "run as->Maven build, install etc.." ON THE PARENT ONLY. The Child projects have no such Maven context menus nor the ability to "run as->Maven x".
If I try to import all 4 projects in step 4 above, it imports with the same structure as outlined in 5 above but with the children appearing additionally as separate "independent" Maven projects (with errors).
Ultimately I just want to import the multi-module Maven project and be able to deploy it on my Eclipse Tomcat installation, so if I change a file in one of the child projects (called frontend) the change will be deployed quickly and I can check the effect out in a browser.
Thank you very much for any and all help with this issue! I am happy to answer any further questions to help trouble shoot the problem.
My projects occasionally also lose this ability (though they have it right after import). Usually it helps to refresh Maven configuration, refresh/clean projects, or restart Eclipse. Note that it should still be possible to run it the long way, so "Run -> Run Configurations -> Maven".
I'm running Helios SR 2, m2e 1.0.0.20110607-2117.
Pretty sure each module would have to have it's own .project settings that you would need to commit.
Did you install the m2e WTP extension? At least in theory that should be a better option than tinkering with project settings outside of Maven/m2e control.
I probably explained the problem poorly in my initial question. The main problem was that I was not able to deploy the webapp component of the multi-module maven project to Tomcat. I was making a couple of basic errors:
I was importing the parent project without selecting the children, assuming Maven would get them all and that would suffice, but it did not: I had to select the parent and all children when importing as Maven project from svn.
I then failed to convert the webapp part of the project to a faceted type, and further failed to select "dynamic web app". I needed (according to a colleague) to then select version 2.5 to avoid incompatibilities with older servlet containers. (not sure how relevant this is to Tomcat 6, which is what I use).
Once this was done I had the parent project and 3 subfolders and also the 3 child projects in their own right appearing in the project explorer (but on file system they all exist under the parent project, as it should be). I could then right click on the webapp module (the eclipse project explorer project, not the subfolder) and run as Maven project (clean, build etc.).
I could then right click and "run on server". I had an error upon publishing about various files being out of sync. I just refreshed the child projects in eclipse and then they would publish successfully.
Eclipse has so many versions, with so many incompatible plugins etc. that it gets confusing very quickly-lots of the tutorials are highly specific to particular versions etc.
Thanks for helping anyway guys.