导入后立即在 Eclipse 项目上激活 Checkstyle
Activate Checkstyle on Eclipse projects immediately after import
在 Eclipse (Oxygen 4.7.1a) 中使用新导入的 Maven 项目时,我必须在项目上手动 激活 Checkstyle 以便 Checkstyle 运行每当项目的构建发生时。
我们可以在一个新导入 Eclipse 的项目中看到它的 .project
文件不包含任何 Checkstyle 性质或构建命令:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
选择Activate Checkstyle后,构建命令和性质被添加到.project
:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
是否有任何方法可以在将 Maven 项目导入 Eclipse 后立即激活 Checkstyle,以便 .project
已经具有构建命令和性质?
不幸的是,这是不可能的,因为最新版本的 Maven Eclipse 集成 (m2e) 中没有实现。有关详细信息,请参阅 https://dev.eclipse.org/mhonarc/lists/m2e-dev/msg01783.html。
这里人们讨论了如何通过编写一个 Eclipse Mojo 来解决这个问题,该 Mojo 在导入后适当地更新 .project:https://github.com/oasp/oasp4j-ide/issues/1。但我相信这还没有人做到。
在 Eclipse (Oxygen 4.7.1a) 中使用新导入的 Maven 项目时,我必须在项目上手动 激活 Checkstyle 以便 Checkstyle 运行每当项目的构建发生时。
我们可以在一个新导入 Eclipse 的项目中看到它的 .project
文件不包含任何 Checkstyle 性质或构建命令:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
选择Activate Checkstyle后,构建命令和性质被添加到.project
:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>test-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
</natures>
</projectDescription>
是否有任何方法可以在将 Maven 项目导入 Eclipse 后立即激活 Checkstyle,以便 .project
已经具有构建命令和性质?
不幸的是,这是不可能的,因为最新版本的 Maven Eclipse 集成 (m2e) 中没有实现。有关详细信息,请参阅 https://dev.eclipse.org/mhonarc/lists/m2e-dev/msg01783.html。
这里人们讨论了如何通过编写一个 Eclipse Mojo 来解决这个问题,该 Mojo 在导入后适当地更新 .project:https://github.com/oasp/oasp4j-ide/issues/1。但我相信这还没有人做到。