Recommended ways to import a maven project into an IDE?

Many IDEs support importing maven projects directly, but maven has a maven-eclipse plugin at startup:

mvn eclipse: eclipse

It will generate the parameters of the eclipse project, then you can import as a general eclipse project.

Which one is better?

I prefer to import directly using m2eclipse since my IDE is Spring Source Suite (eclipse 3.5 comes with WTP 3.1 and m2eclipse).

I'm not sure m2eclipse imports a maven project internally using the "maven-eclipse-plugin" to convert to an eclipse project.

Does maven-eclipse-plugin support WTP 3.1 project parameters? From my experiments, maven-eclipse-plugin cannot create WTP 3 above compatible settings.

+4
source share
5 answers

Which one is better?

They are different. The maven-eclipse plugin is very lightweight because it does nothing once the project has been imported into Eclipse, but does not provide real integration: there is no bi-directional support, there is no pom.xml editor, there are no fancy wizards, there is no module creation from Eclipse ... I personally it doesn't matter what many of these features are. However, there is one thing that I really need in many projects: support for filtering resources within the IDE. m2eclipse does this because it implements Maven.

I'm not sure m2eclipse imports a maven project internally using the "maven-eclipse-plugin" to convert to an eclipse project.

No, this does not add a new nature to the project.

Does maven-eclipse-plugin support WTP 3.1 project parameters? From my experiments, maven-eclipse-plugin cannot create WTP 3 above compatible settings.

The plugin can create WTP R7, 1.0, 1.5, and 2.0 configuration files. WTP 2.0 configuration files are compatible with WTP 3.0 (the structure has not changed).

You can declare the wtpversion parameter on the command line or in the plugin configuration. Below is an example:

  <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.8</version> <configuration> <projectNameTemplate>[artifactId]-[version]</projectNameTemplate> <wtpmanifest>true</wtpmanifest> <wtpapplicationxml>true</wtpapplicationxml> <wtpversion>2.0</wtpversion> <manifest>${basedir}/src/main/resources/META-INF/MANIFEST.MF</manifest> </configuration> </plugin> 
+2
source

We use the mvn eclipse: eclipse method, and it works great, but I believe that the m2eclipse plugin would be the preferred way, since this integration seems to be very simple. I did not use it myself because we use RAD, which is based on an older version of Eclipse, which does not support this plugin.

+2
source

I prefer

 mvn eclipse:eclipse 

myself. I used the m2eclipse plugin, but I had a few problems with it regarding the recognition of projects that have already been created, and also populates my eclipse context menu with a lot more elements. I prefer my IDE to have as few plugins as possible and prefer to work with maven from the command line. It also helps, as in my team, we don’t have a standard IDE, so we don’t put the IDE generated artifacts in the initial control. Knowing that everything can be built from the command line very easily helps with the independence of the IDE, as well as from continuous integration.

+2
source

(Usually) Built-in plug-ins in the IDE are better than the general ones provided by the product, because they know their own format better, they can access the built-in functions used by the IDE and stay up to date with updates.

Here I would highly recommend the built-in Eclipse plugin.

+1
source

I can share with you my experience with JetBrains IDEA .

It is better to use the Maven import function from IDEA instead of maven, because the IDE knows better the format of the project you must create.

As an example, I don't know if mvn: idea creates project files for IDEA 9.

0
source

Source: https://habr.com/ru/post/1312561/


All Articles