【发布时间】:2018-02-28 20:37:10
【问题描述】:
在 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 已经拥有构建命令和性质?
【问题讨论】:
标签: eclipse maven checkstyle