There is no "Convert to Maven" Option when I do Right Click - eclipse

I have a project which is divided into 3 sub project each for special purpose:
I put this project in bitbucket and then I imported it into eclipse but after importing the project, when I right click, I cannot see the "Configure -> Convert to Maven" option. But when I click on the folder (called omid) containing sub projects, I can find it. But I need to convert each sub project separately into maven since one of them is a webapp project, and the other are simple java projects. For more visualization look at the screenshots below:
But in the following image you can see what happens when I click on each sub project (there is no configure -> convert to maven):

I believe your problem is that you imported just the root module into Eclipse and you need to also explicitly import the sub modules as their own Maven projects. Go to File -> Import and choose the "Existing Maven Projects" option. Once this is selected you should be able to choose any project that contains a pom.xml file. You have two options from here. You could import both your root module (which is already imported) and all sub modules as Maven projects, or you can just import all sub modules.

Related

Creating new project in Eclipse from Github parent/child pom?

What's the correct way to create a project in Eclipse from a github project which uses the parent/child pom construct, for example https://github.com/vladmihalcea/vladmihalcea.wordpress.com ?
I can clone/download it ok, but then do I need to manually create an eclipse project for each sub-project within or is there a better way?
(Googled the hell of out this question without finding an answer, but please feel free to post a link if you know of such.)
Use the Import feature of Eclipse.
Select File / Import ... from the Eclipse menu.
From the Import dialog window, Select the Maven / Existing Maven Projects wizard option.
Click Next.
From the Import Maven Projects dialog, choose the root directory using the Browse directory chooser.
With the directory choosen, the dialog will be populated with all available Maven projects. Check all the projects to be imported.
Click Finish.

Import multiple projects in IntelliJ IDEA

I have a number of projects in my Eclipse workspace, some of them plain ol' Java projects, some of them Java web applications, some of them Flash Builder Flex projects.
They all live in a directory hierarchy. How can I open all of them in IntelliJ IDEA to be able to migrate from Eclipse to IDEA? The projects reference each other.
You can create an IntellIJ IDEA Project from source using the Import Project in the main menu.
Select the eclipse .project file or .classpath then check Link created IntelliJ IDEA modules to Eclipse project files.
The official docs, here:
To import an existing Eclipse projects to IntelliJ IDEA:
Open the New
Project Wizard. Having selected the option Import project from
external model, click Next.
On the Import page of the New Project
Wizard, select Eclipse. Optionally, check the option Import into
current project. Click Next.
On the next page of the wizard, specify
the directory, that contains the desired Eclipse workspace. In the
section IntelliJ IDEA project and module file location, specify
whether you want to create IntelliJ IDEA module files in the same
directory where the Eclipse projects reside, or in a dedicated
directory of your choice.
Check the option Link created IntelliJ IDEA
modules to Eclipse project files to automatically synchronize the
Eclipse projects and IntelliJ IDEA modules.
Specify whether you want test sources to be imported.
Click Next. IntelliJ IDEA scans the specified workspace for projects.
On the next page of the wizard, select the Eclipse projects you want
to import. So doing, each Eclipse project is converted to a separate
IntelliJ IDEA module. Click Next. Specify the name for the new
IntelliJ IDEA project, and the location of the project files.
Select also the format in which the project will be stored. Click Finish.
If you select "Keep project and modules in" you could separate eclipse project and IntelliJ IDEA project files
I never did something like this, but after reading docs and playing a bit the options it should be the best way.

Importing maven sourceproject into eclipse

I have imported my maven project in eclipse using Import Maven project. It got import in eclipse project explorer, but all the source folder are opening as files and folders, its not opening as java source folder. Since its opening as files and folder, it doesnot have compilation unit, found very difficult to code using it.
What do I need to do inorder to make the source folder as java source folder so that I can code easily?
Select the project and from the context menu choose Maven -> Update Project Configuration (This menu item gets reworded across various maven releases so look for something similar). You may also need to choose Update Dependencies.
In the shell/command line, execute mvn eclipse:eclipse

multi module maven project structure in eclipse

I have two modules under a main project
main
|
|
--module-a
|
|
--module-b
I created it using eclipse->new ->Maven project, eclipse->new->maven module.
The structure in the file system looks correct. But in eclipse, it shows module-a, module-b as two new projects in the package explorer.
My main project looks like this.
I have seen few multi module projects where, the modules are present within the main project in package explorer. The main project had
module-a/src/main/java
module-a/src/test/java
module-a/src/resources/java
module-b/src/main/java
module-b/src/test/java
module-b/src/resources/java.
How do I convert my project to look like this ?
Starting from Eclipse 4.5.M5 (that you can already download at http://eclipse.org/downloads ), the Project Explorer view has a parameter to show projects hierarchically, to better handle such case. See https://www.eclipse.org/eclipse/news/4.5/M5/ for details.
You will find if you navigate the actual file system (oe use the 'navigator' view in eclipse) that the sub modules do in fact exist underneath the main parent project folder.
Eclipse is nice enough (clever enough or whatever) to pull them out when you use the 'package explorer' view. I guess this makes it easier to find and navigate your way aournd a highly modular project.
However if you set up your Parent POM correctly you can have a flat structure to your modular project if you so desire (I haven't as yet been able to get this to work, so far I think it is related to the sub module classpaths or something?).
David.
I solved this problem as follows:
Under the "Project Explorer" click on the "View Menu" (little triangle) and select "Filters and Customization..."
Under the "Content" tab tick "Nested Projects"
Finally, Under the "Pre-set filters" tab tick "Nested Projects: hide folders when projects is shown as nested" and "Nested Projects: hide-top-level project if shown as nested".
By doing that I come up with the following structure.
I used a Spring Tool Suite 3: Version: 3.9.11
Basically, Eclipse does not support the Maven way of structuring projects.
By using the M2E it is possible to execute Maven as part of the build, but that way you lose the project management and incremental build capabilities of Eclipse.
You can also simply use the Eclipse layout in the IDE, and build with Maven in the build server, but that way you have to make sure the two build are identical.
I have seen few multi module projects where, the modules are present
within the main project in package explorer.
Thats what do maven eclipse plugin. It just create single project with multiple source directories for each module of maven multimodule project.
If you want to see some hierarchical structure in eclipse - use working sets. Create working set with name of parent, add module-a and module-b to it and visually it will be separated from other projects in eclipse workspace.
You can do this in earlier versions of eclipse as well. Close and Remove the sub-module projects (as they are already present in the parent folder). Now click on Properties on the main project -> Project Facets -> Convert to faceted form. This will detect Java automatically, Click on Apply, OK. Now you can see that these modules are created with Source folders

Eclipse : Importing Existing Projects into workspace

We have a Existing project downloaded from server which was build on Maven .
(this is in the form of Folder Structure )
While import that project in Eclipse , should i use
Existing Projects into workspace
Or
File System
Please guide me
Thank you .
If you import a project into the workspace the files remain in their original locations. I do not know how to avoid this.
Often (always) I would like to have a copy of the files in the workspace and leave the project I imported it from in its original location untouched.
A frequent use-case is that I have a project and wish to make some changes to it to test out something without affecting the main project.
Thanks John
If you really have an existing project, then you must have a .project file. Check for that, and if you do have, you should use the Existing Projects into workspace option, and select the root folder of your project.
Since you have a Maven project, you could also import it as Existing Maven Projects, given that you have the Maven plugin installed in your eclipse.
File -> Import... -> General -> Existing Project into Workspace -> Select the archive file by clicking Browse button -> Select the checkbox * Copy projects into workspace. (this answers user462990's question). This way the project is copied into the workspace and the main project is not affected.
If you use "File -> Import... -> Maven -> Existing Maven Projects" you don't get the option to copy projects into workspace.