【发布时间】:2016-05-09 22:12:08
【问题描述】:
我有一个使用 Tycho 构建的 Eclipse 插件代码库。它使用在指定 Checkstyle 配置名称的依赖工件中定义的父 POM。
我还使用 checkstyle 配置检查了父 pom。我已将 Eclipse 配置为使用与 Maven 构建相同的配置文件。
我发现 Maven 报告列出了 Eclipse 报告未提及的另一项违规行为。
在我正在查看的特定 Java 源文件中,Maven 报告生成了以下列表:
3: warning: Empty line should be followed by <p> tag on the next line.
8: warning: 'package' should be separated from previous statement.
26: warning: First sentence should be present.
31: warning: First sentence should be present.
34: warning: First sentence should be present.
48: warning: First sentence should be present.
对于相同的源文件,使用相同的 Checkstyle 配置文件,Eclipse 会报告除第一个警告之外的所有内容。
如果重要的话,这里是文件的前几行,包括第 3 行:
/*******************************************************************************
* Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
* // line 3
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
具有讽刺意味的是,我无法“修复”这个警告,因为我们的项目当前为许可证文件指定了特定格式,而在下一行添加“p”违反了该格式。
无论如何,我的问题不是修复警告,而是理解为什么 Eclipse 和 Maven 使用相同的 Checkstyle 配置文件报告的违规行为不同。
据我了解,与此违规相关的类别是“JavadocParagraph”。我的 Checkstyle 配置文件包含此类别,但它不会覆盖“allowNewlineParagraph”属性。据推测,此属性的默认值为 true。这对我来说意味着 Maven 以某种方式决定将此属性设置为“false”,但 Eclpse 仍然看到默认的未指定值“true”。
【问题讨论】:
-
您使用的是哪个版本的 Maven Checkstyle 插件?是 2.16 还是更早版本?
-
是的,2.16。如果重要的话,Eclipse Checkstyle 插件的 6.16.0.201603042321 版本。
标签: eclipse maven checkstyle