Can I Configure m2eclipse through pom.xml?

后端 未结 3 1144
执念已碎
执念已碎 2020-12-03 11:19

With the maven-eclipse-plugin, using mvn eclipse:eclipse, you can specifiy eclipse project natures and builders that will automatically be added to the eclipse project.

3条回答
  •  眼角桃花
    2020-12-03 11:52

    I have now implemented this as a maven plugin I call maven-eclipseconf-plugin. Unfortunately it's proprietary work for a client, so I can't share it. But let me describe what I do:

    Tied to the lifecycle verify, I check for the existence of an eclipse .project file. If it's there, I check it for the presence of the builders and natures I want to automatically add (and you can deactivate this behavior by using a maven property or a stop file with a configurable name). You can also define configuration files that will be written (like .pmd, which is related to this other question of mine). The contents of the Configuration files can be specified inline, it can come from an external file, or from a URL. I also tried to introduce variable substitution in the config files where a special placeholder would be replaced with a multi-moduke-project's root folder, but I had to give up on that approach.

    Anyway, the plugin gives me pretty much all the functionality of the maven-eclipse-plugin I ever used (of course there is a lot more though) and I'm happy with that. Perhaps I will build something similar once more in open source when this contract is finished.

提交回复
热议问题