-->

IDE with better Maven support than Eclipse with m2

2019-07-22 00:53发布

问题:

We are using maven for manage multi-module projects and Eclipse with m2e for development.

Unfortunately Eclipse by itself does not understand the way Maven works, and even if m2e does a lot of work to make the "a parent pom with modules" Maven way look like the "several logically independent projects" Eclipse way it breaks when I e.g. add a new module to the parent pom. If Maven was a first class citizen I would expect Eclipse to pick up the new module immediately as a new Maven project.

Is there another IDE which has better Maven support, or should I instead lobby the m2e folks?

回答1:

Didn't work alot with it, but for my knowledge, Netbeans IDE seems to have a quite good maven integration.

Just give it a try on a short example project!



回答2:

1st of all lobbying the m2e folks is always good - better support for maven is always a good thing.

having said that i work on a ~200-modules maven project using intellij idea. its maven support (which is available in their community edition) is simply great - you dont even need the maven idea plugin to create your project, you just import your pom directly.

it will also correctly handle changes you make to your pom - just add a new to a parent pom and idea will actually offer to create the corresponding directory and child pom for you. and after that it will add the new child module to the project. it also supports "conditional" child modules - modules defined under various profiles. when you enable/disable maven profiles (maven panel, right side of the IDE) it will correctly add/remove child modules to/from the idea project.

not that for larger projects you would want to turn this auto-import off and manually re-import your project (idea will prompt you, or worst-case there's a button for it on the maven panel) as automatically reimporting very large projects will be noticable.

idea will correctly map multi-module tree-like projects into idea multi-module project and will automatically pick up on your libraries, dependencies, maven profiles, etc. its also very easy to execute maven operations directly from it (maven panel on the right side of the IDE).

it doesnt pick on some of our more complicated build steps (we have some utility bound to he lifecycle that generates some of our source code using the maven exec plugin and if you just do a project-->build all from intellij its not picked up for example) but those things arent common. also, you can get around this by executing maven directly from the IDE instead of trying to build from the IDE.

not perfect, but the best i've seen.