必须将我们的 maven 汇编器版本从 1.1.6 更新到 1.1.8。这是发生的唯一变化,现在 Sonar Maven 插件抛出了这个异常:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.2:sonar
(default) on project ReconCoverage: java.util.ArrayList cannot be cast to java.lang.String ->
插件:
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.7</version>
<groupId>com.CORPNAME.raptor.build</groupId>
<artifactId>assembler-maven-plugin</artifactId>
<version>1.1.8</version>
我已经研究了大约一个星期,需要升级到这个汇编版本。没有其他团队在升级时遇到此问题,因为他们通过 jenkins 使用 Sonar。我正在使用 maven 插件,因为我们的项目有很多模块,并且它构建了覆盖结果以匹配它。
我查看了声纳的代码,它似乎发生在 sonar.batch.bootstrap.userproperties 中。我猜这是在传入声纳属性时发生的,例如:sonar.language、sonar.java.coveragePlugin、sonar.host.url 等。
覆盖属性示例:
<sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.host.url>http://corp.sonar.url/</sonar.host.url>
<sonar.jdbc.url>jdbc:oracle:thin:@sonardb.corp.com:0000:sonardb</sonar.jdbc.url>
<sonar.jdbc.username>username</sonar.jdbc.username>
<sonar.jdbc.password>password</sonar.jdbc.password>
<sonar.jdbc.driver>oracle.jdbc.driver.OracelDriver</sonar.jdbc.driver>
根据声纳的代码,它通常通过 Map 获取属性。当这些字符串之一是数组列表时,它会引发此异常。无论如何配置我的属性,以便新的 maven 汇编程序正确传递这些值?