Ниже приведен сценарий моего градиента, и я пытаюсь использовать плагин checkstyle, но у меня возникает проблема при его использовании.Получение проблемы в плагине checkstyle в скрипте gradle
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'checkstyle'
//-- set the group for publishing
group = 'com.rohit.singh'
/**
* Initializing GAVC settings
*/
def buildProperties = new Properties()
file("version.properties").withInputStream {
stream -> buildProperties.load(stream)
}
//add the jenkins build version to the version
def env = System.getenv()
if (env["BUILD_NUMBER"]) buildProperties.engineBuildVersion += "_${env["BUILD_NUMBER"]}"
version = buildProperties.engineBuildVersion
println "${version}"
//name is set in the settings.gradle file
group = "com.xxxx.engine"
version = buildProperties.engineBuildVersion
println "Building ${project.group}:${project.name}:${project.version}"
sourceCompatibility = 1.6
jar {
manifest {
attributes 'Implementation-Title': "${project.name}",
'Implementation-Version': "${project.version}",
'Implementation-Vendor-Id': "${project.group}"
}
}
repositories {
maven {
url "http://xjhxxxx.xxxx.xxxxx.com:99999/artifactory/repo1-cache"
}
}
dependencies {
compile ([
"com.eaio.uuid:uuid:3.2",
"org.springframework:spring-context:2.5.6",
"org.springframework:spring-beans:1.2.6" ,
"org.springframework:spring-core:1.2.3",
"org.springframework:spring-aop:3.0.6.RELEASE",
"org.springframework:spring-expression:3.0.7.RELEASE",
"org.projectlombok:lombok:1.12.2",
"com.fasterxml.jackson.core:jackson-core:2.1.3",
"com.fasterxml.jackson.core:jackson-annotations:2.2.3",
"com.fasterxml.jackson.core:jackson-databind:2.2.3",
"org.slf4j:slf4j-api:1.7.6",
"org.apache.commons:commons-lang3:3.0",
"junit:junit:4.+"
])
}
jacoco {
toolVersion = "0.7.1.201405082137"
}
test {
jacoco {
append = false
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
classDumpFile = file("$buildDir/jacoco/classpathdumps")
}
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
executionData = fileTree(dir: 'build/jacoco', include: '**/*.exec')
reports {
xml{
enabled true
//Following value is a file
destination "${buildDir}/reports/jacoco/xml/jacoco.xml"
}
csv.enabled false
html{
enabled true
//Following value is a folder
destination "${buildDir}/reports/jacoco/html"
}
}
}
findbugs {
ignoreFailures = true
//sourceSets = [sourceSets.main]
}
pmd {
ruleSets = ["java-basic", "java-braces", "java-design"]
ignoreFailures = true
//sourceSets = [sourceSets.main]
}
checkstyle {
configFile = new File(rootDir, "config/checkstyle/checkstyle.xml")
ignoreFailures = true
sourceSets = [sourceSets.main]
}
// adding test report to taskGraph
build.dependsOn checkstyleReport
// ------ Publish the jar file to artifactory ------
artifacts {
archives jar
}
Выход:
Невозможно создать Checker: не удалось найти C: \ MERCURIAL_WORKSPACE \ Common \ конфи г \ Checkstyle \ checkstyle.xml
Спасибо, что ответили на вопрос. Я исправил его уже. Да, вы правы, недостающая часть была checkstyle.xml file.I создала его в папке config, а затем снова запускала и работала. – Sushant