maven checkstyle无法找到插入包含配置的位置

发布于 2025-01-06 09:25:40 字数 1413 浏览 2 评论 0原文

我们有一个 Maven 项目,我在构建过程中使用了 checkstyle 插件,我们非常喜欢 checkstyle。无论如何,最近我们需要将 Web 服务插入到我们的项目中。 Web 服务类与 checkstyle 不兼容,因此我们希望在构建时排除它们。因此,作为排除的一种方式,我们要指定要包含的文件夹。

我遇到过 maven.checkstyle.includes 和 checkstyle 插件的 sourceDirectory 。但我无法弄清楚如何在 pom.xml 中使用它们。

有人有主意吗?

这是我的 pom.xml 的 checkstyle 部分

<build>
...
<plugin>    
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.8</version>
                    <executions>
                      <execution>
                        <phase>process-sources</phase>
                        <goals>
                          <goal>check</goal>
                        </goals>
                      </execution>
                    </executions>
                    <configuration>
                        <failsOnError>true</failsOnError>
                        <consoleOutput>true</consoleOutput>
                        <configLocation>sample_config.xml</configLocation>
                        <sourceDirectory>${maven.checkstyle.includes}</sourceDirectory>
                    </configuration>
                </plugin>
...
</build>

We have a maven project where I use a checkstyle plugin in the build process and we are very fond of checkstyle. Anyway recently we need to insert web services to our project. The web services classes are not compatible with checkstyle so we want to exclude them when building. So as a way of exclude we want to specify the folders to be included.

I have come across maven.checkstyle.includes and sourceDirectory of checkstyle plugin. But I could not be able to figure out how to use them in pom.xml.

Anyone have an idea?

Here is my checkstyle section of pom.xml

<build>
...
<plugin>    
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>2.8</version>
                    <executions>
                      <execution>
                        <phase>process-sources</phase>
                        <goals>
                          <goal>check</goal>
                        </goals>
                      </execution>
                    </executions>
                    <configuration>
                        <failsOnError>true</failsOnError>
                        <consoleOutput>true</consoleOutput>
                        <configLocation>sample_config.xml</configLocation>
                        <sourceDirectory>${maven.checkstyle.includes}</sourceDirectory>
                    </configuration>
                </plugin>
...
</build>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叫嚣ゝ 2025-01-13 09:25:40
       <excludes>my/package/**/*</excludes>

将其添加到您的配置部分。这些是 ant 风格的模式,您可以通过用逗号分隔它们来为插件提供多个模式。

       <excludes>my/package/**/*</excludes>

Add this to your configuration section. These are ant style patterns and you can give the plugin multiple patterns by separating them with a comma.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文