sonarqube { properties { property 'sonar.projectName', "${projectTitle} :: Plugin API" } } configureCompileJavaToVersion 8 apply plugin: 'com.github.johnrengelman.shadow' dependencies { // please keep the list grouped by configuration and ordered by name compile 'commons-io:commons-io' compile 'commons-lang:commons-lang' compile 'com.google.code.gson:gson' // shaded, but not relocated compile project(':sonar-check-api') compileOnly 'ch.qos.logback:logback-classic' compileOnly 'com.google.code.findbugs:jsr305' compileOnly 'javax.servlet:javax.servlet-api' compileOnly 'junit:junit' // Used by LogTesterJUnit5 compileOnly 'org.junit.jupiter:junit-jupiter-api' compileOnly 'org.slf4j:slf4j-api' testCompile 'com.google.guava:guava' testCompile 'com.tngtech.java:junit-dataprovider' testCompile 'org.assertj:assertj-core' testCompile 'org.mockito:mockito-core' testCompile project(':sonar-plugin-api-impl') } sourceSets { // Make the compileOnly dependencies available when compiling/running tests test.compileClasspath += configurations.compileOnly + configurations.shadow test.runtimeClasspath += configurations.compileOnly + configurations.shadow } def on3Digits(version) { def projectversion3digits = version - ~/-\w+/ projectversion3digits = projectversion3digits.tokenize('.').plus(0).take(3).join('.') } import org.apache.tools.ant.filters.ReplaceTokens processResources { filter ReplaceTokens, tokens: [ // The build version is composed of 4 fields, including the semantic version and the build number provided by Travis. 'project.buildVersion': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version) + '.' + (System.getProperty("buildNumber") ?: '0'), 'project.version.3digits': project.version.endsWith('SNAPSHOT') ? project.version : on3Digits(project.version) ] } shadowJar { configurations = [project.configurations.default] minimize { exclude(project(':sonar-check-api')) } relocate('com.google', 'org.sonar.api.internal.google') relocate('org.apache.commons', 'org.sonar.api.internal.apachecommons') } // only interested in shadowJar jar.enabled = false artifactoryPublish.skip = false publishing { publications { mavenJava(MavenPublication) { artifact source: shadowJar, classifier: null if (release) { artifact sourcesJar artifact javadocJar } } } }