- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在一个多模块项目中,有一个在目录 target/generated-sources/xjc3/com/...
中生成一些源代码我正在尝试使 Maven checkstyle 插件跳过此生成的源目录。尽管尝试了 <excludes>
的多种语法tag,它会不断扫描这个源目录。 有人知道如何从审核中删除这个生成的源目录吗?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>checkstyle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>cloudstack-checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>cloud-style.xml</configLocation>
<consoleOutput>true</consoleOutput>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<includes>**\/*.java</includes>
<excludes>**\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/apidoc\/,**\/generated-sources\/,**\/generated-sources\/*,**\/generated-sources\/**,**\/generated-sources\/**\/*.*,**/generated-sources/**/*.*,**/generated-sources/**/*,**/generated-sources/**,**/generated-sources/*,**/generated-sources/*.*</excludes>
</configuration>
</plugin>
这是插件调试输出,它显示它不断包含生成的源目录:
[INFO] --- maven-checkstyle-plugin:3.0.0:check (cloudstack-checkstyle) @ cloud-plugin-network-vcs ---
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0, parent: sun.misc.Launcher$AppClassLoader@74a14482]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check' with basic configurator -->
[DEBUG] (f) cacheFile = /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/checkstyle-cachefile
[DEBUG] (f) configLocation = cloud-style.xml
[DEBUG] (f) consoleOutput = true
[DEBUG] (f) encoding = UTF-8
[DEBUG] (f) excludes = **\/deps\/,**\/test\/,**\/target\/,**\/bin\/,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat,**\/apidoc\/,**\/generated-sources\/,**\/generated-sources\/*,**\/generated-sources\/**,**\/generated-sources\/**\/*.*,**/generated-sources/**/*.*,**/generated-sources/**/*,**/generated-sources/**,**/generated-sources/*,**/generated-sources/*.*
[DEBUG] (f) failOnViolation = true
[DEBUG] (f) failsOnError = true
[DEBUG] (f) headerLocation = LICENSE.txt
[DEBUG] (f) includeResources = true
[DEBUG] (f) includeTestResources = true
[DEBUG] (f) includeTestSourceDirectory = true
[DEBUG] (f) includes = **\/*.java
[DEBUG] (f) logViolationsToConsole = true
[DEBUG] (f) maxAllowedViolations = 0
[DEBUG] (f) omitIgnoredModules = false
[DEBUG] (f) outputFile = /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/checkstyle-result.xml
[DEBUG] (f) outputFileFormat = xml
[DEBUG] (f) plugin = Component Descriptor: role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugins.checkstyle.CheckstyleViolationCheckMojo', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugins.checkstyle.CheckstyleReport', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:checkstyle'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugins.checkstyle.CheckstyleAggregateReport', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:checkstyle-aggregate'
role: 'org.apache.maven.plugin.Mojo', implementation: 'org.apache.maven.plugins.checkstyle.HelpMojo', role hint: 'org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:help'
---
[DEBUG] (f) project = MavenProject: org.apache.cloudstack:cloud-plugin-network-vcs:4.12.0.0-SNAPSHOT @ /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/pom.xml
[DEBUG] (f) resourceIncludes = **/*.properties
[DEBUG] (f) resources = [Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/main/resources, PatternSet [includes: {}, excludes: {}]}}, Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc1, PatternSet [includes: {**/jaxb.properties, **/bgm.ser}, excludes: {}]}}, Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc2, PatternSet [includes: {**/jaxb.properties, **/bgm.ser}, excludes: {}]}}, Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc3, PatternSet [includes: {**/jaxb.properties, **/bgm.ser}, excludes: {}]}}, Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/maven-shared-archive-resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG] (f) rulesFiles = /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/checkstyle-rules.xml
[DEBUG] (f) skip = false
[DEBUG] (f) skipExec = false
[DEBUG] (f) suppressionsFileExpression = checkstyle.suppressions.file
[DEBUG] (f) testResources = [Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/test/resources, PatternSet [includes: {}, excludes: {}]}}, Resource {targetPath: null, filtering: false, FileSet {directory: /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/maven-shared-archive-resources, PatternSet [includes: {}, excludes: {}]}}]
[DEBUG] (f) violationSeverity = error
[DEBUG] -- end configuration --
[DEBUG] executeCheckstyle start headerLocation : LICENSE.txt
[DEBUG] Added 27 source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/main/java'.
[DEBUG] Added 5 source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc1'.
[DEBUG] Added 5 source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc2'.
[DEBUG] Added 7 source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc3'.
[DEBUG] Added 0 source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/annotations'.
[DEBUG] Added 3 test source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/test/java'.
[DEBUG] Added 0 test source files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-test-sources/test-annotations'.
[DEBUG] Added 1 resource files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/main/resources'.
[DEBUG] Added 0 resource files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc1'.
[DEBUG] Added 0 resource files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc2'.
[DEBUG] Added 0 resource files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc3'.
[DEBUG] Added 0 resource files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/maven-shared-archive-resources'.
[DEBUG] The resources directory '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/test/resources' does not exist or is not a directory.
[DEBUG] Added 0 resource files found in '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/maven-shared-archive-resources'.
[DEBUG] Added 48 files to process.
[DEBUG] Adding the outputDirectory file:/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/classes/ to the Checkstyle class path
[DEBUG] Adding the outputDirectory file:/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/test-classes/ to the Checkstyle class path
[DEBUG] request.getConfigLocation() cloud-style.xml
[DEBUG] The resource 'cloud-style.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.
[DEBUG] The resource 'cloud-style.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.JarResourceLoader.
[DEBUG] URLResourceLoader: No valid URL 'cloud-style.xml'
[DEBUG] URLResourceLoader: No valid URL 'cloud-style.xml'
[DEBUG] The resource 'cloud-style.xml' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader.
[DEBUG] The resource 'cloud-style.xml' was found as jar:file:/home/marco/.m2/repository/org/apache/cloudstack/checkstyle/4.12.0.0-SNAPSHOT/checkstyle-4.12.0.0-SNAPSHOT.jar!/cloud-style.xml.
[DEBUG] headerLocation LICENSE.txt
[DEBUG] The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.FileResourceLoader.
[DEBUG] JarResourceLoader : trying to load "jar:file:/home/marco/.m2/repository/org/apache/cloudstack/checkstyle/4.12.0.0-SNAPSHOT/checkstyle-4.12.0.0-SNAPSHOT.jar"
[DEBUG] JarResourceLoader : trying to load "jar:file:/home/marco/.m2/repository/com/puppycrawl/tools/checkstyle/8.7/checkstyle-8.7.jar"
[DEBUG] The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.JarResourceLoader.
[DEBUG] URLResourceLoader: No valid URL 'LICENSE.txt'
[DEBUG] URLResourceLoader: No valid URL 'LICENSE.txt'
[DEBUG] The resource 'LICENSE.txt' was not found with resourceLoader org.codehaus.plexus.resource.loader.URLResourceLoader.
[DEBUG] Unable to process header location: LICENSE.txt
[DEBUG] Checkstyle will throw exception if ${checkstyle.header.file} is used
[DEBUG] Added '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/src/main/resources' as a source directory.
[DEBUG] Added '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc1' as a source directory.
[DEBUG] Added '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc2' as a source directory.
[DEBUG] Added '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc3' as a source directory.
[DEBUG] Added '/home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/maven-shared-archive-resources' as a source directory.
[INFO] Starting audit...
[ERROR] /home/marco/code/cloudstack-public/plugins/network-elements/brocade-vcs/target/generated-sources/xjc1/com/cloud/network/schema/interfacevlan/ObjectFactory.java:2: Line has trailing spaces. [RegexpSingleline]
最佳答案
如果您的所有模块都有一致的源文件夹位置,您可以将源文件夹锁定到“真实”源
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<sourceDirectories>
<sourceDirectory>src/main/java</sourceDirectory>
</sourceDirectories>
</configuration>
</plugin>
或者(最好)包括来源和测试
<sourceDirectories>
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
<sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
</sourceDirectories>
关于maven - 禁用 checkstyle maven 插件生成的源目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48618140/
发现一个类似的问题,关于 QAPlug-FindBugs 和 FindBugs-IDEA 之间的区别,但不是关于 CheckStyle... 我认为(根据以前的经验)这些插件的一个区别是 QAPlug
试图弄清楚我是否做错了什么,或者这是否是 maven checkstyle 插件中的错误。如果我执行 mvn checkstyle:check 我会得到这个: jonathanfisher@odin
我想确保我的代码不超过 5 级缩进,如下所示: class Foo { // 0 void bar() { // 1 if () { // 2 if (
FileTabCharacter检查似乎对我不起作用。下面是我的配置: .. .. .. .. .. .. 我有 XML 文件 - pom.xml和 checksty
有没有办法设置 checkstyle 来防止方法体中的前导、多个或尾随空行: 例如 private void a() { - int a = 1; doStuff(a); - - doMoreStuf
有没有办法设置 checkstyle 来防止方法体中的前导、多个或尾随空行: 例如 private void a() { - int a = 1; doStuff(a); - - doMoreStuf
我是 CheckStyle 等 Java 静态代码分析工具的新手。我下载了 Checkstyle 包并看到了 2 组检查: checkstyle_checks.xml sun_checks.xml。
我想使用//@checkstyle:off 和//@checkstyle:on 来免除代码的某些部分被 checkstyle 检查,但它仍然在提示。 public void invoke() {
我正在尝试将 import-control 添加到我们的 checkstyle 中,使 import-control 文件存在于制作 checstyle.xml 文件的项目中,而不是我们稍后构建的项目
我跑了mvn checkstyle:checkstyle ,但它没有使用我的自定义 checkstyle XML 文件。 请告诉我如何使用我自己的 checkstyle 文件而不是默认/现在配置的文件
执行命令mvn checkstyle:checkstyle时出现以下错误: An error has occurred in Checkstyle report generation. ... Cau
在我正在处理的一个项目中,我们有很多自定义 Checkstyle 检查。例如,我们使用 RegexpSingleline 模块排除所有类型的东西。我们的检查样式规则如下所示:
我正在使用 checkstyle获取有关我的源代码的报告。这个问题是关于MagicNumberCheck . 我正在使用 Date/(org.joda.)DateTime在我的源代码中是这样的: Da
我通过命令行上的 mvn 构建我的项目。 每当发生 checkStyle 错误时,我都会看到这种类型的输出: [ERROR] Failed to execute goal org.apache.mav
我有一个使用 Tycho 构建的 Eclipse 插件代码库。它使用在依赖 Artifact 中定义的父 POM,该 Artifact 指定 Checkstyle 配置的名称。 我还使用 checks
我是使用 Jenkins 的新手,我最近用它构建了一个项目并安装了“Checkstyle”插件并收到了一份报告。 我想知道如何配置“Checkstyle”以忽略空格或其他可能出现的标准? 谢谢! 最佳
我过去使用过检查样式,记得使用快捷键来应用检查样式修复(节省大量点击)。我不记得我是否为它设置了快捷方式,或者它是否已经附带了一个。 我的问题分为两部分:1)有没有一种简单的方法来检查是否有“Appl
我正在使用一个基本的 maven 项目,其中在 pom.xml 中只定义了以下内容: 依赖 javaee-api 依赖 junit 插件 maven-compile-plugin 插件 maven-w
我试图让 maven-checkstyle-plugin 对我们所有的项目使用相同的配置文件。 我尝试了几种方法,但没有一种是有效的。 唯一似乎有效的是当我将配置文件放在我的 maven 项目的根目录
我在 maven 构建中添加了 checkstyle 但由于某种原因它只检查 src/main 文件夹并忽略 src/test 文件夹,这是我的项目结构: Proj - Module A -
我是一名优秀的程序员,十分优秀!