m2e-extensions and m2e-code-quality to close the gap?
Unwillingly to wait for Checkstyle, PMD and FindBugs to integrate their Eclipse plugins with m2eclipse, Mohan KR from Basis Technology Corp. developed m2e-extensions.[3],[4] Figure 1 shows how this plugin integrates into Maven and Eclipse.
Figure 1: m2e-extensions as Project Configurator (Click to enlarge) |
Let's take PMD as example. To leverage the PMD configuration in pom.xml for Eclipse, m2e-extensions acts as project configurator:
- On checking out or editing pom.xml, m2eclipse initiates the configuration of the java project. It calls every project configurator that had been registered before.
- The project configurator of m2e-extensions reads the configuration of the Maven PMD plugin from pom.xml.
- The project configurator adds the PMD project facet and the PMD builder to the java project and creates the file .pmd.
Too many pitfalls for me
m2e-extensions as of version 0.10.0.201003211855 and m2e-code-quality as of version 0.12.0.201101251749 had the following drawbacks:
- In the medium term, each project configurator should migrate to its dedicated plugin. For example, the PMD project configurator natively belongs in the PMD Eclipse plugin. As long as each project configurator is not adopted by its dedicated plugin, there is a risk of future incompatibility or abandonment. This could happen with each new version of m2eclipse or of the other Eclipse plugins.
- On each saving of an edited pom.xml, the configuration files of Checkstyle and PMD are recreated. This might slow down Eclipse. And any manual configuration, that the user has added meanwhile, will be overwritten.
- If the Checkstyle configuration is a classpath resource, eclipse is configured to directly point to the JAR in the Maven repository. This works for stable configurations. But when the JAR changes in the repository, the class loading fails in java.util.zip.InflaterInputStream.[7] Surprisingly, classpath resources for PMD work without this problem.
- checkstyle.header.file is not defined as property for the Checkstyle Eclipse plugin. As a consequence of this, the header file location from pom.xml is not used for the Checkstyle Eclipse plugin. As workaround, we have to use an absolute path as location for our header file in checks.xml. Alternatively, we could specify an inline header in checks.xml via the header property.
- Excludes for PMD do not work, at least with m2e-code-quality.[8]
- FindBugs is not supported at the moment.
References
- ^ Ackermann, M. Solutions for Enterprise IT. "Use Maven to Configure Checkstyle, PMD and FindBugs Consistently in Eclipse" [cited 2011 Feb 16]
- ^ Ackermann, M. Solutions for Enterprise IT. "Configure Eclipse Projects from Maven with AntRun and XMLTask" [cited 2011 Mar 6]
- ^ KR, M. Nabble Maven Forum. "m2e-extensions up" [cited 2011 Feb 6]
- ^ Google, Inc. Google Code. "m2e-extensions" [cited 2011 Feb 6]
- ^ Margulies, B. m2e-users Mailing List. "Anyone want checkstyle and PMD?" [cited 2011 Feb 6]
- ^ GitHub, Inc. GitHub. "m2e-code-quality" [cited 2011 Feb 6]
- ^ Oracle Corporation. Bug Database. "URLClassLoader fails to reload resources from dynamically changed jar-files" [cited 2011 Feb 6]
- ^ GitHub, Inc. m2e-code-quality Issues. "excludes does not work for PMD" [cited 2011 Feb 6]
No comments:
Post a Comment