如何在gradle的jar项目中获得sonarqube中的jacoco结果?
我很难让jacoco和sonarqube从web服务项目使用的库项目中的代码中获得代码覆盖率结果。这是我的Gradle mutli模块项目的基本布局如何在gradle的jar项目中获得sonarqube中的jacoco结果?,gradle,sonarqube,jacoco,multi-module,sonarqube-scan,Gradle,Sonarqube,Jacoco,Multi Module,Sonarqube Scan,我很难让jacoco和sonarqube从web服务项目使用的库项目中的代码中获得代码覆盖率结果。这是我的Gradle mutli模块项目的基本布局 母公司 图书馆项目1 图书馆项目2 Web服务项目 Gradle 2.13和org.sonarsource.scanner.Gradle:sonarqube Gradle插件:2.1-rc3 我的父项目在build.gradle中具有sonar属性。我在webService项目中有一个integrationTest任务。webService
- 母公司
- 图书馆项目1
- 图书馆项目2
- Web服务项目
buildscript {
ext { springBootVersion = '1.4.1.RELEASE' }
dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") }
}
apply plugin: 'spring-boot'
jar { archiveName = 'schema.jar' }
configurations {
all*.exclude group: "org.slf4j", module: "slf4j-simple"
all*.exclude group: "org.hibernate", module: "hibernate-entitymanager"
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile("org.eclipse.persistence:org.eclipse.persistence.jpa:2.6.4")
compile("org.springframework:spring-orm")
compile('org.springframework.boot:spring-boot-starter-web')
compile("com.oracle.jdbc:ojdbc7:12.1.0.2")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
bootRepackage { enabled = false }
编辑:
有人能做到这一点吗?我发现了这个示例代码,我认为它有点不同
// get source dirs for project dependencies
FileCollection getSonarSrcDirs(List projects) {
Set srcDirs = sourceSets.main.java.srcDirs
projects.each {
def projDir = project(it).projectDir
srcDirs.add("${projDir}/src/main/java")
}
return files(srcDirs)
}
sonarqube {
properties {
property "sonar.sources", getSonarSrcDirs([':library1',':library2'])
}
}
但当我运行声纳时,我得到以下信息
File '/scratch/workspace/project/library1/src/main/java/Application.java' is ignored. It is not located in module basedir '/scratch/workspace/project/ws'.
不允许我将依赖模块放在对等目录中,而不是ws-project文件夹的子目录中吗?澄清一下:您的“库项目”是由源代码还是jar组成的?构成jar的源代码。build.gradle有“jar{archiveName='schema.jar'}”。或者这不是将其纳入webService项目的最佳方式?