sonar-maven-plugin:无法设置sonar.sources src / main / resources

2024-02-24

我的 maven-sonar 设置有问题。我需要将所有项目文件包含在src/主/java and src/主/资源这样 SonarQube 将显示我所有文件的结果,但排除其中的一些文件src/main/resources/static/文件。对于测试路径,它已经默认设置为src/测试/java

这就是我设置 POM.XML 的方式

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.1.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->

    <!-- Sonar static analysis / Jacoco code coverage -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <start-class>com.Example.wp.WpCoreApplication</start-class>
    <java.version>1.8</java.version>
    <sonar.sources>src/main/java, src/main/resources</sonar.sources>
    <sonar.exclusions>src/main/resources/static/file</sonar.exclusions>
</properties>

<dependencies>
    <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-cassandra</artifactId> 
        </dependency> -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-neo4j</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>info.debatty</groupId>
        <artifactId>java-string-similarity</artifactId>
        <version>RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.11</version>
    </dependency>
</dependencies>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.7.2</version>
        </plugin>
    </plugins>
</reporting>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.19.1</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>${jacoco.agent.argLine}</argLine>
                    <skipTests>false</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.7.201606060606</version>
            <configuration>
                <dataFile>target/jacoco.exec</dataFile>
            </configuration>
            <executions>
                <execution>
                    <id>jacoco-initialize</id>
                    <phase>initialize</phase>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                    <configuration>
                        <propertyName>jacoco.agent.argLine</propertyName>
                        <destFile>target/jacoco.exec</destFile>
                    </configuration>
                </execution>
                <execution>
                    <id>jacoco-report</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1-alpha-3</version>
            <executions>
                <execution>
                    <id>attach-rpm</id>
                    <goals>
                        <goal>attached-rpm</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

但是当我使用命令提示符运行我的 maven-sonar 时:mvn 声纳: 声纳。有这样的错误日志

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.865 s
[INFO] Finished at: 2016-11-28T14:46:40+07:00
[INFO] Final Memory: 68M/449M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:
3.1.1:sonar (default-cli) on project wp: The directory 'D:\PROJECT\wp-core\
src\main\resources' does not exist for Maven module com.sample:wp:jar:0.1.26. Pleas
e check the property sonar.sources -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception

如何设置声纳以便它可以扫描我的所有文件?我已经看过了文档 http://docs.sonarqube.org/display/SONAR/Analysis+Parameters和这个堆栈溢出 https://stackoverflow.com/questions/21425012/configure-sonar-to-exclude-files-from-maven-pom-xml


您可能应该删除多余的空间。改变

<sonar.sources>src/main/java, src/main/resources</sonar.sources>

to

<sonar.sources>src/main/java,src/main/resources</sonar.sources>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

sonar-maven-plugin:无法设置sonar.sources src / main / resources 的相关文章

  • 如何自动执行使用 Maven 构建的 Eclipse 插件的版本号更新过程

    我正在处理一个与该项目类似的项目此处描述 http www vogella com articles EclipseTycho article html 因此 它在父 pom xml 中有一些模块
  • 任务“:app:dexDebug”执行失败

    我目前正在处理我的项目 我决定将我的 Android Studio 更新到新版本 但在我导入项目后 它显示如下错误 Information Gradle tasks app assembleDebug app preBuild UP TO
  • Android - 如何访问 onResume 中 onCreate 中实例化的 View 对象?

    In my onCreate 方法 我正在实例化一个ImageButton View public void onCreate Bundle savedInstanceState super onCreate savedInstanceSt
  • Google 地图查询返回的 JSON 包含像 \x26 这样的编码字符(如何解码?)

    在 Java 应用程序中 我获取 JSON 来自 Google 地图 其中包含以下字符 x26我想将其转换为其原始字符 据我所知 这是一个 UTF 8 表示法 但我不完全确定 在源 JSON 中 可能会出现各种编码字符 例如 x3c div
  • MP3:一种以毫秒为单位获取任何给定字节位置的位置的方法?

    我创建了一个 servlet 它返回从客户端请求的任何给定字节位置开始的流 来自 MP3 文件 这允许客户端在任何给定字节位置立即开始播放 而无需进行任何本地查找 现在 我有一个滑块可以直观地显示进度 我正在使用当前字节位置来更新滑块 但是
  • 如何打印整个字符串池?

    我想打印包含文字的整个字符串池String使用添加的对象intern 就在垃圾收集之前 JDK有没有隐式的方法来进行这样的操作 我们如何检查字符串池 EDIT The comment suggests that there may be a
  • Java 创建浮雕(红/蓝图像)

    我正在编写一个 Java 游戏引擎 http victoryengine org http victoryengine org 并且我一直在尝试生成具有深度的 3D 图像 您可以使用那些红色 蓝色眼镜看到 我正在使用 Java2D 进行图形
  • 使用 Checkstyle Plugin 时从插件调用代码时出现问题:“org.eclipse.jface”

    我正在尝试在 Rational Software Architect 7 0 0 4 上使用 eclipse cs 插件 我最近卸载了旧的 beta2 版本并安装了 beta3 插件本身按照之前的配置工作 但是每当我尝试通过 Windows
  • 无法加载 jar 文件的主类

    我使用 Eclipse IDE 开发了一个应用程序 创建应用程序后 我以 jar 格式导出项目 当我尝试运行此 jar 文件时 出现错误 无法加载主类 请帮忙 当您将项目导出为 jar 时 请参阅此所以问题 https stackoverf
  • 通过 InjectMocks Spy 注入对象

    我需要对一个类运行一系列单元测试 该类具有 Autowired Logger 实现 实现的基本思想是 Mock Logger logger InjectMocks TestedClass tested 但我想保存日志输出功能 Mockito
  • 使用 Spring 时实例化对象,用于测试与生产

    使用 Spring 时 应该使用 Spring 配置 xml 来实例化生产对象 并在测试时直接实例化对象 这样的理解是否正确 Eg MyMain java package org world hello import org springf
  • 方法断点可能会大大减慢调试速度

    每当向方法声明行添加断点 在 Intellij IDEA 或 Android Studio 中 时 都会出现一个弹出窗口 方法断点可能会大大减慢调试速度 为什么会这样戏剧性地减慢调试速度 是我的问题吗 将断点放在函数的第一行有什么不同 Th
  • 服务器到 Firebase HTTP POST 结果为响应消息 200

    使用 Java 代码 向下滚动查看 我使用 FCM 向我的 Android 发送通知消息 当提供正确的服务器密钥令牌时 我收到如下所示的响应消息 之后从 FCM 收到以下响应消息 Response 200 Success Message m
  • spring - 强制 @Autowired 字段的 cglib 代理

    我有混合堆栈 EJB 和 Spring 为了将 Spring 自动装配到 EJB 我使用SpringBeanAutowiringInterceptor 不确定这是否会影响我遇到的问题 在尝试通过以下方式自动装配 bean 时 Scope p
  • 使用 Java 在浏览器中下载 CSV 文件

    我正在尝试在 Web 应用程序上添加一个按钮 单击该按钮会下载一个 CSV 文件 该文件很小 大小仅约 4KB 我已经制作了按钮并附加了一个侦听器 文件也准备好了 我现在唯一需要做的就是创建单击按钮时下载 csv 文件的实际事件 假设 fi
  • 使用 Guava 联合两个 ImmutableEnumSets

    我想联合两个ImmutableEnumSets来自番石榴 这是我的尝试 public final class OurColors public enum Colors RED GREEN BLUE YELLOW PINK BLACK pub
  • 如何在java中使jpeg无损?

    有没有人可以告诉我如何使用编写 jpeg 文件losslessjava中的压缩 我使用下面的代码读取字节来编辑字节 WritableRaster raster image getRaster DataBufferByte buffer Da
  • 如何使用 Mockito 和 Junit 模拟 ZonedDateTime

    我需要模拟一个ZonedDateTime ofInstant 方法 我知道SO中有很多建议 但对于我的具体问题 到目前为止我还没有找到任何简单的解决办法 这是我的代码 public ZonedDateTime myMethodToTest
  • 从 Stax XMLStreamReader 读取以解组部分

    我正在使用 Stax 游标 API 从大型 xml 文件中提取数据 当前 我转到特殊标签的开头并使用 JAXB 解组该标签 这对于格式良好的 xml 文件效果很好 但不久前我有一个文档 其中数十万个标签中有一个未关闭 JAXB 使用 XML
  • Java中有类似分支/跳转表的东西吗?

    Java有类似分支表或跳转表的东西吗 分支表或跳转表是 根据维基百科 http en wikipedia org wiki Branch table 用于描述使用分支指令表将程序控制 分支 转移到程序的另一部分 或可能已动态加载的不同程序

随机推荐

  • 如何合并两个图像

    我有一个单一的图像 我有一个带有横幅图像的集合视图 现在 我需要将这两个图像组合成单个图像 而不影响它们的质量和高度 以便我能够下载合并的图像 我搜索但找不到 swift 3 的正确解决方案 我的代码如下 根据你的问题 你必须添加两个图像并
  • 如何在 Swift 中的泛型类上实现 NSCoding?

    我在 Swift XCode beta 5 中的泛型类和 NSCoding 方面遇到问题 具体来说 此示例代码运行良好 class Foo NSObject NSCoding let bar String init bar String s
  • 调用 API 期间出现 cURL 错误。 cURL 错误号:[60] SSL 证书问题:证书链中的自签名证书

    美好的一天 我是服务器设置的新手 我目前正在使用 laravel 5 4 来集成我的快书应用程序 https github com intuit QuickBooks V3 PHP SDK在我的实时服务器上http qb dagnum co
  • sql中的连续天数

    我发现了很多有关连续几天的 stackoverflow QnAs 答案仍然太短 我无法理解发生了什么 为了具体起见 我将制作一个模型 或表格 如果有什么区别的话 我正在使用 postgresql CREATE TABLE work id i
  • 在 JavaScript 中解析 jQuery 数据 (JSON)

    我正在使用 PHP jQuery 和 JSON 现在我需要知道如何在 JavaScript 中解析 jQuery 数据 load php 它通过以下数据返回 jQuery name STA distance 250 code 25 name
  • 同一任务执行多次

    我有 ETA 任务发送到 Celery 的 Redis 代理 它是一个 celery 和 redis 实例 两者都在同一台机器上 问题是 任务被执行多次 我见过任务执行了 4 到 11 次 鉴于我的预计到达时间在 4 11 小时之间 在运行
  • Dropbox 中未同步的 Git 存储库

    我有一个 git 存储库 和工作目录 存储在我的 Dropbox 中 这样我就可以在计算机之间来回移动 而无需提交或存储 阅读 完全不需要任何努力 这一切都很有效 除了一个小烦恼正在变成一个大烦恼之外 每隔一段时间 我会让一台计算机处于完全
  • 如何以编程方式确定当前类的Java字节码版本? [复制]

    这个问题在这里已经有答案了 我遇到的情况是 部署平台是 Java 5 并且开发是在 Java 6 下使用 Eclipse 进行的 我们建立了一个在开始处理给定项目时创建新工作区的过程 因此 所需步骤之一是将编译器级别设置为 Java 5 这
  • 在 AWS Lambda Layers 中找到等效的环境变量?

    我正在 AWS 上编写一个无服务器应用程序 我已将该应用程序分解为许多 Clo udFormation 堆栈 我正在使用 CDK Python 中 创建 CF 堆栈来部署应用程序 当然 我的 lambda 函数的核心要求是能够记录事件 为了
  • 如何获取 ScrollController 的完整大小

    我已将 ScrollController 附加到 SliverAppBar SliverList 的 CustomScrollView 在默认情况下 我会使用reverse true和animateTo 0 0 将滚动移动到添加的最后一个元
  • 没有为“listen ... ssl”指令定义“ssl_certificate”

    我正在尝试为我的网站配置 nginx 服务器 我正在使用以下代码来配置我的服务器 如果我为 www fastenglishacademy fr 443 服务器块添加 default server 它就会起作用 但在这种情况下 我的所有子域也
  • Firebase webpack+babel 功能未部署

    是否可以使 firebase 函数与 webpack 和 babel 一起使用 我们需要在服务器端重用现有的 ES6 类 但我们无法编辑这些类 因此我们需要转译它们以使其在 Node 中工作 花了两天时间学习相关教程 但我遇到了一个问题 即
  • 如何防止用户在iOS上截取应用程序的屏幕截图?

    我想防止用户对我的应用程序进行屏幕截图 并在最近的项目上隐藏其内容 你知道相当于Android的吗FLAG SECURE特征 https developer android com reference android view Window
  • R:创建一个函数来识别任意百分位数

    我正在使用 R 编程语言 我有以下数据集 library dplyr var1 rnorm 10000 100 100 var2 rnorm 10000 100 100 var3 rnorm 10000 100 100 var4 rnorm
  • Crystal 报表中的动态列

    我需要创建动态报告 如果在数据库中添加列 则该列应该自动反映在水晶报告中 我想知道水晶报告中是否可以使用动态列 如果是的话 如何实现 据我所知 通过在数据库中添加一列 您无法通过数据表在水晶报告上获取它 但您可以通过存储过程获取它 但您必须
  • `int` 是原子类型吗?

    Quoting gnu https www gnu org software libc manual html node Atomic Types html 实际上 您可以假设 int 是原子的 您还可以假设指针类型是原子的 非常方便 这两
  • 如何将 python 集合转换为 numpy 数组?

    我在 python 中使用集合操作来执行两个 numpy 数组之间的对称差异 然而 结果是一个集合 我需要将其转换回 numpy 数组才能继续 有没有办法做到这一点 这是我尝试过的 a numpy array 1 2 3 4 5 6 b n
  • .NET 中的 BODMAS 原理

    今天我发现 NET 框架在进行计算时遵循 BODMAS 操作顺序 即按以下顺序进行计算 Brackets Orders Division 乘法 Addition 减法 但是我四处搜索 找不到任何文档来证实 NET确实遵循这个原则 哪里有这样
  • 对广播接收器进行单元测试?

    这是我项目中的一个 BroadcastReceiver 我正在对其进行单元测试 当用户拨打电话时 它会获取电话号码 并设置启动新活动的意图 并传入电话号码 public class OutgoingCallReceiver extends
  • sonar-maven-plugin:无法设置sonar.sources src / main / resources

    我的 maven sonar 设置有问题 我需要将所有项目文件包含在src 主 java and src 主 资源这样 SonarQube 将显示我所有文件的结果 但排除其中的一些文件src main resources static 文件