【发布时间】:2016-08-24 18:15:14
【问题描述】:
要求mvn clean install sonar:sonar 将快照从机器 Maven 部署/安装到机器 SonarQube,它将把它存储在具有 MySql 数据库的机器 MySql 中。
Machine MySql 仅对 Machine SonarQube 可见。机器 SonarQube 对 Intranet 可见,Intranet 中的每个人都可以访问它。
从 Machine Maven 运行 mvn clean install sonar:sonar 时会出现以下错误:
[ERROR] 未能执行目标 org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project my-project:连接数据库失败:无法加载 JDBC 驱动程序类 'org.h2.Driver' -> [帮助 1]
Machine Maven 在 ~/.m2/settings.xml 中有以下配置文件:
<profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.host.url>https://sonarqube.myproject.com</sonar.host.url> </properties> </profile>
根据here 中的文档添加了sonar-maven-plugin。
sonar-maven-plugin 也被添加为 pom.xml 的依赖项:
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.5</version>
</dependency>
我知道documentation 要求在我不想暴露给其他人的 maven 设置声纳配置文件属性中指定 jdbc 驱动程序、url、用户名和密码,因此这已在 Machine SonarQube conf 中指定/sonar.properties
有没有办法通过 Machine SonarQube 将这些快照解聚/安装到 Machine MySql,从 Machine Maven 运行“mvn clean install sonar:sonar”?
提前致谢。
【问题讨论】: