I have the following basic publishing code.
buildscript {
repositories {
maven {
url "${artifactory_contextUrl}/plugins-release"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
allprojects {
apply plugin: "com.jfrog.artifactory"
apply plugin: 'maven'
apply plugin: 'maven-publish'
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = "${publish_repository_key}"
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = "${resolve_repository_key}"
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
clientConfig.timeout = 10
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact 'test-1.1/abc-1.1.py'
version "1.5"
groupId "com.example"
artifactId "script"
}
}
}
artifactoryPublish {
publications ('mavenJava')
publishBuildInfo = false
publishArtifacts = false
publishPom = false
publishIvy = false
}
For a test I would like not to publish BuildInfo and Pom. Despite the fact all publishing is set to false invoking
gradle clean generatePomFileForMavenJavaPublication artifactoryPublish
and observing http traffic and console output confirms that all upload is still taking place.
Deploying artifact: https://artifactory/publish_repository_key/com/example/script/1.5/script-1.5.py
Deploying artifact: https://artifactory/publish_repository_key/com/example/script/1.5/script-1.5.pom
Error occurred for request PUT /publish_repository_key/com/example/script/1.5/script-1.5.pom.sha1;build.name=script;build.number=1512095807403 HTTP/1.1: Read timed out.
In addition last error completely puzzles me.
It looks like a bug. Feel free to follow it here. I'll update this answer once it's fixed.
Related
I have been trying to run spotbugs plugin on my projects using a global build.gradle setup. The plugin is added and seems that build is running. Build and spotbugsMain both are successful when I run them using
./gradlew :com.myproject.something:build --stacktrace
./gradlew :com.myproject.something:spotbugsMain --stracktrace
But if I understand it correctly, it should generate a report (in spotbugs folder?) under build-gradle folder.
I do not see anything generated. spotbugs folder itself is not showing up.
Here is my build.gradle. Can someone please tell me what I am doing wrong? I am not sure I understand concepts of gradle completely but I have tried to use other references.
Minimal working SpotBugs setup for Android Studio
plugins {
id "com.github.spotbugs" version "4.7.2" apply false
}
group = 'com.myproject'
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.spotbugs'
buildDir = 'build-gradle'
spotbugs {
toolVersion = '4.3.0'
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = 'max'
reportLevel = 'high'
maxHeapSize = '1g'
reportsDir = file("$buildDir/spotbugs")
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
group 'Verification'
description 'Run Spotbugs on this project.'
dependsOn 'assemble'
reports {
xml.enabled = false
html.enabled = true
}
classDirs = files('$buildDir.absolutePath/build-gradle/classes/java/main')
sourceDirs = files('$buildDir.absolutePath/src/main/java')
}
repositories {
// the order here is important. Repositories are queried in the exact order specified here
mavenLocal()
mavenCentral()
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/snapshots')
allowInsecureProtocol = true
}
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/releases')
allowInsecureProtocol = true
}
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/myproject')
allowInsecureProtocol = true
}
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/thirdparty')
allowInsecureProtocol = true
}
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
test {
filter {
excludeTestsMatching "*IT"
environment 'RESOURCES_PATH', 'build-gradle/resources/test'
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
}
UPDATE : 07/26/2021
I tried to run full build including all the subprojects instead of individual subproject as mentioned above. I used command
./gradlew clean build --stacktrace
This time, it did not work! The full build is throwing an error as below.
Task :com.vmturbo.mediation.applicationserver.jboss:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':com.myproject.something:compileJava'.
Could not resolve all files for configuration ':com.myproject.something:compileClasspath'.
Could not find com.github.spotbugs:spotbugs-annotations:4.7.2.
Searched in the following locations:
- file:/Users/myuser/.m2/repository/com/github/spotbugs/spotbugs-annotations/4.7.2/spotbugs-annotations-4.7.2.pom
- https://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs-annotations/4.7.2/spotbugs-annotations-4.7.2.pom
- http://build.myproject.com:8081/nexus/content/repositories/snapshots/com/github/spotbugs/spotbugs-annotations/4.7.2/spotbugs-annotations-4.7.2.pom
- http://build.myproject.com:8081/nexus/content/repositories/releases/com/github/spotbugs/spotbugs-annotations/4.7.2/spotbugs-annotations-4.7.2.pom
- http://build.myproject.com:8081/nexus/content/repositories/myproject/com/github/spotbugs/spotbugs-annotations/4.7.2/spotbugs-annotations-4.7.2.pom
- http://build.myproject.com:8081/nexus/content/repositories/thirdparty/com/github/spotbugs/spotbugs-annotations/4.7.2/spotbugs-annotations-4.7.2.pom
Required by:
project :com.myproject.something
Any idea about the problem? It seems full build does not work with above error and if I try to build only 1 subproject com.myproject.something then it runs fine but does not generate anything related to spotbugs.
I found the problem. I am not entirely sure why though. This thread helped.
https://github.com/spotbugs/spotbugs/issues/1027
In my build.gradle I was using this block ->
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
group 'Verification'
description 'Run Spotbugs on this project.'
dependsOn 'assemble'
reports {
xml.enabled = false
html.enabled = true
}
classDirs = files('$buildDir.absolutePath/build-gradle/classes/java/main')
sourceDirs = files('$buildDir.absolutePath/src/main/java')
}
But instead when I changed that to this, all seemed to work and spotbugs folder and under it, report got generated. Apparently, I did not need to provide class and source folders at all.
spotbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
spotbugsTest {
reports {
xml.enabled = false
html.enabled = true
}
}
FINAL build.gradle file
plugins {
id "com.github.spotbugs" version "4.7.2" apply false
}
group = 'com.myproject'
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.spotbugs'
buildDir = 'build-gradle'
spotbugs {
toolVersion = '4.3.0'
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = 'max'
reportLevel = 'high'
maxHeapSize = '1g'
reportsDir = file("$buildDir/spotbugs")
}
spotbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
spotbugsTest {
reports {
xml.enabled = false
html.enabled = true
}
}
repositories {
// the order here is important. Repositories are queried in the exact order specified here
mavenLocal()
mavenCentral()
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/snapshots')
allowInsecureProtocol = true
}
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/releases')
allowInsecureProtocol = true
}
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/myproject')
allowInsecureProtocol = true
}
maven {
url = uri('http://build.myproject.com:8081/nexus/content/repositories/thirdparty')
allowInsecureProtocol = true
}
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
test {
filter {
excludeTestsMatching "*IT"
environment 'RESOURCES_PATH', 'build-gradle/resources/test'
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
}
Ran these commands and they succeeded - meaning that I got spotbugs errors in code and build failed! which is what I was looking for!
./gradlew check and ./gradlew clean build --stacktrace
7 SpotBugs violations were found. See the report at: file:///Users/myuser/com.myproject.something/build-gradle/spotbugs/test.html
You can refer to this answer:
Minimal working SpotBugs setup for Android Studio.
Following which I let my android project run successfully and got the spotbugs check report. The report will be generated in path of {module_name}/build/spotbugsReports/main.html. The running command can be ./gradlew build or ./gradlew spotbugsMain.
In build.gradle of app module:
apply plugin: 'com.github.spotbugs' // <- Add this
spotbugs {
toolVersion = "3.1.3"
ignoreFailures = false
showProgress = true
reportsDir = file("$project.buildDir/spotbugsReports")
effort = "max"
reportLevel = "high"
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
group 'Verification'
description 'Run Spotbugs on this project.'
// You'll also need to enable the HTML report and disable XML report, to see a human-readable format.
reports {
xml.enabled = false
html.enabled = true
}
dependsOn 'assemble'
classes = files("$projectDir.absolutePath/build/intermediates/javac")
source = fileTree('src/main/java') // Only needed on gradle 4/5
}
// This block is only needed for gradle 4/5 only.
// It's for SpotBugs to create a 'spotbugsMain' gradle task.
sourceSets {
main {
java.srcDirs = []
}
}
android {
...
}
dependencies {
...
}
In build.gradle of root project:
buildscript {
repositories {
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
}
}
allprojects {
repositories {
...
}
}
The Gradle Wrapper Version of my project is gradle-4.10.1-all.zip. Pay attention that when you'are using Gradle v4 - lastest Spotbugs version you could use only 1.6.6. Ref: https://gist.github.com/mik9/fdde79052fef7f03c4325734701a39d7
I'm trying to publish my first Gradle plugin to maven central (sonatype), but I'm receiving the following error:
Execution failed for task ':publishBom-pluginPluginMarkerMavenPublicationToMavenRepository'.
> Failed to publish publication 'bom-pluginPluginMarkerMaven' to repository 'maven'
> Could not PUT 'https://oss.sonatype.org/service/local/staging/deploy/maven2/bom-plugin/bom-plugin.gradle.plugin/0.3/bom-plugin.gradle.plugin-0.3.pom'.
Received status code 400 from server: Bad Request
It seems that for some reason, the publishing task is trying to publish my plugin at the root of the sonatype repository, it works when I do execute the task publishToMavenLocal, however, published this strange file in my m2 local: /.m2/repository/bom-plugin/bom-plugin.gradle.plugin and also publish the plugin here /.m2/repository/dev/thiagosouto/bom-plugin/0.3/
I think this is causing the issue but I don't have any clue to solve this problem.
My build.gradle.kts file
plugins {
java
`java-gradle-plugin`
`kotlin-dsl`
`maven-publish`
signing
kotlin("jvm") version "1.4.31"
id("com.gradle.plugin-publish") version "0.13.0"
}
group "dev.thiagosouto"
version "0.3"
buildscript {
repositories {
mavenCentral()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
}
gradlePlugin {
plugins {
create("bom-plugin") {
id = "bom-plugin"
implementationClass = "dev.thiagosouto.plugins.bom.BomPlugin"
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation("com.squareup:kotlinpoet:1.7.2")
testImplementation("com.google.truth:truth:1.1.2")
testImplementation("junit:junit:4.13.2")
testImplementation("dev.thiagosouto:file-butler:0.3.0")
}
sourceSets.main {
java.srcDirs("src/main/kotlin")
}
sourceSets.test {
java.srcDirs("src/test/kotlin")
}
tasks.withType<GenerateModuleMetadata> {
enabled = false
}
publishing {
val ossrhUsername: String by project
val ossrhPassword: String by project
repositories {
maven(url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
}
publications {
group = "dev.thiagosouto"
version = "0.3"
create<MavenPublication>("mavenJava") {
pom {
name.set("bom-plugin")
description.set("A library to help apply tdd through help functions");
url.set("https://thiagosouto.dev")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
scm {
connection.set("scm:git:git://github.com/othiagosouto/bom-plugin.git/")
developerConnection.set("scm:git:ssh://github.com:othiagosouto/bom-plugin.git")
url.set("https://github.com/othiagosouto/bom-plugin")
}
developers {
developer {
id.set("othiagosouto")
name.set("Thiago Souto silva de barros Santos")
email.set("soutosss#gmail.com")
}
}
}
}
}
}
afterEvaluate {
signing {
sign(publishing.publications["mavenJava"])
}
}
I want to build a jar out of my Gradle project and push it to the nexus repository. As part of this, I created a Jenkins file and added a task "publishing" task in build.gradle.
My Jenkins file:
pipeline {
agent any
environment {
NEXUS = credentials('nexus-user')
}
options {
ansiColor('xterm')
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '100')
}
triggers { pollSCM('H/5 * * * *') }
stages {
stage('Checkout'){
steps { checkout scm }
}
stage('Build') {
steps { sh "./gradlew assemble" }
}
stage('deploy') {
steps {
sh "gradle -Duser.home=\"$WORKSPACE\" --gradle-user-home=\"$WORKSPACE/.gradle\" -PnexusUsername=$NEXUS_USR -PnexusPassword=$NEXUS_PSW publish"
}
}
}
}
And build.gradle
publishing {
publications{
maven(MavenPublication){
artifactId = "testApp"
from components.java
}
}
repositories {
maven {
url = "http://localhost:8081/nexus/content/repositories/${version.endsWith('-SNAPSHOT') ? "snapshots" : "releases"}"
credentials {
username = "Dont know how to pass the username here"
password = "Dont know how to pass the password here"
}
}
}
}
Could anyone tell me how to get the username and password from Gradle and set here for publishing the jar to nexus.
Answer is:
publishing {
publications{
maven(MavenPublication){
artifactId = "testApp"
from components.java
}
}
repositories {
maven {
url = "http://localhost:8081/nexus/content/repositories/${version.endsWith('-SNAPSHOT') ? "snapshots" : "releases"}"
credentials {
username = "nexusUsername"
password = "nexusPassword"
}
}
}
}
I have previously successfully set up bintray and artifactory accounts to publish snapshot versions to the OSS JFrog Artifactory repository, but after setting up a GitHub/Bintray/Artifactory organisation under the same user, I am unable to publish snapshots.
When attempting to run
./gradlew artifactoryPublish -Dsnapshot=true -DbintrayUser=myBintrayUser -DbintrayKey=myBintrayApiKey -DbuildNumber=#
I get the following error:
java.io.IOException: Failed to deploy file. Status code: 401 Response message: Artifactory returned the following errors:
Unauthorized Status code: 401
I've tried using both bintray users (my personal and the organisation) but get the same response. I've also tried regenerating a new API key at https://bintray.com/profile/edit, but has not worked (and now also seems to be out of sync with the key at https://oss.jfrog.org/artifactory/webapp/#/profile) which I can't edit.
The build.gradle file is:
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
}
plugins {
id 'java-library'
id 'maven'
id 'maven-publish'
// Automatic SEMVER
// ./gradlew release
id 'net.vivin.gradle-semantic-build-versioning' version '4.0.0' apply false
// SNAPSHOT publishing to oss-jfrog-artifactory
// ./gradlew artifactoryPublish -Dsnapshot=true -DbintrayUser=<YOUR_USER_NAME> -DbintrayKey=<YOUR_API_KEY> -DbuildNumber=NNN
id 'com.jfrog.artifactory' version '4.6.2'
// RELEASE publishing to bintray
// ./gradlew bintrayUpload -DbintrayUser=<YOUR_USER_NAME> -DbintrayKey=<YOUR_API_KEY>
id 'com.jfrog.bintray' version '1.8.1'
}
wrapper.gradleVersion = '4.5.1'
def groupName = 'noxtech'
group = 'uk.co.noxtech'
archivesBaseName = 'noxtech-java-utils'
description = 'Assorted Java 8 utilities'
def projectUrl = "https://github.com/noxtech/noxtech-java-utils"
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
api 'joda-time:joda-time:2.9.9'
implementation 'org.projectlombok:lombok:1.16.20'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
javadoc.failOnError = false
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
def pomConfig = {
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
scm {
url projectUrl
}
}
publishing {
publications {
mavenPublication(MavenPublication) {
from components.java
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
groupId = project.group
artifactId = project.archivesBaseName
version = project.version.toString()
pom.withXml {
def root = asNode()
root.appendNode('description', project.description)
root.appendNode('name', project.name)
root.appendNode('url', projectUrl)
root.children().last() + pomConfig
}
}
}
repositories {
maven {
// change to point to your repo, e.g. http://my.org/repo
url "$buildDir/repo"
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
publications = ['mavenPublication']
pkg {
repo = "maven"
name = project.archivesBaseName
userOrg = groupName
licenses = ['Apache-2.0']
websiteUrl = projectUrl
vcsUrl = projectUrl + '.git'
issueTrackerUrl = projectUrl + '/issues'
version {
name = project.version.toString()
desc = project.description
vcsTag = project.version.toString()
released = new Date()
}
}
}
artifactory {
contextUrl = 'http://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local'
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
password = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
}
defaults {
publications('mavenPublication')
publishArtifacts = true
publishPom = true
}
}
resolve {
repoKey = 'jcenter'
}
clientConfig.info.setBuildNumber(project.hasProperty('buildNumber') ? project.property('buildNumber') : System.getenv('BUILD_NUMBER'))
}
This turned out to be a simple solution. When moving over to use the organisation from the personal account on CircleCI, the environment variables were lost.
Does anyone know if a good test coverage tool (preferably Gradle plugin) exists for Kotlin? I've looked into JaCoCo a bit, but it doesn't seem to reliably support Kotlin.
As requested, here is an example build.gradle that uses Kotlin, and incorporates both Jacoco and Sonarqube integration, produces a jar and sources, and ties in Detekt for static analysis.
I had to manually add a couple things as my work build has jacoco applied by an in-house plugin.
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.2.10'
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.10'
id 'org.springframework.boot' version '1.5.9.RELEASE'
id 'io.spring.dependency-management' version '1.0.4.RELEASE'
id 'io.gitlab.arturbosch.detekt' version '1.0.0.RC6'
id "org.sonarqube" version "2.6.2".
}
apply plugin: 'jacoco'
ext {
springBootVersion = '1.5.9.RELEASE'
springCloudVersion = 'Dalston.SR4'
kotlinVersion = '1.2.10'
detektVersion = '1.0.0.RC6'.
}
//======================= Project Info =============================================
group = 'group'
version = '0.14'
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-starter- parent:$springBootVersion")
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion"
}
}
repositories {
jcenter()
}
//======================= Dependencies =============================================
dependencies {
// Version MUST be explicitly set here or else dependent projects will not be able to build as Gradle will not know
// what version to use
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compile 'org.springframework.boot:spring-boot-starter-web'
compile('org.springframework.ws:spring-ws-support') {
exclude(module: 'javax.mail')
}
compile 'org.springframework.boot:spring-boot-starter-actuator'
// Spring security
compile 'org.springframework.security:spring-security-web'
compile 'org.springframework.security:spring-security-config'
compile 'javax.servlet:javax.servlet-api'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml'
compile('org.apache.httpcomponents:httpclient')
compile 'com.nimbusds:nimbus-jose-jwt:4.23'
}
//======================= Tasks =============================================
defaultTasks 'build'
tasks.bootRepackage.enabled = false
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = 1.8
freeCompilerArgs = ["-Xjsr305=strict"]
}
}
compileJava.options.encoding = 'UTF-8'
test.testLogging.exceptionFormat = 'full'
// ********************************
ext.coverageExclusions = [
// Configuration
'com.bns.pm.config.*',
// data classes
'com.bns.pm.domain.*',
// Account Service domain objects
'com.bns.pm.account.domain.*',
// Other items
'com.bns.pm.exceptions.DataPowerFaultException.Companion',
'com.bns.pm.controllers.ServiceExceptionHandler*',
'com.bns.pm.service.callback.DPWebServiceMessageCallback',
'com.bns.pm.service.HealthCheckService',
'com.bns.pm.util.SystemPropertiesUtilKt',
]
check.dependsOn jacocoTestCoverageVerification
jacocoTestCoverageVerification {
violationRules {
rule {
element = 'CLASS'
// White list
excludes = coverageExclusions
limit {
minimum = 0.70
}
}
}
}
jacocoTestReport {
description 'Generates Code coverage report. Fails build if it does not meet minimum coverage.'
reports {
xml.enabled = true //XML required by coveralls and for the below coverage checks
html.enabled = true
csv.enabled = false
}
def reportExclusions = coverageExclusions.collect {
it.replaceAll('\\.', '/') + (it.endsWith('*') ? '' : '*')
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, excludes: reportExclusions)
})
}
}
test.finalizedBy jacocoTestReport
afterEvaluate {
sonarqube {
properties {
property 'sonar.jacoco.reportPath', "${buildDir}/jacoco/test.exec"
property "detekt.sonar.kotlin.config.path", "detekt.yml"
property 'sonar.java.binaries', "$projectDir/build/classes/kotlin"
property 'sonar.coverage.exclusions', coverageExclusions.collect {
'**/' + it.replaceAll('\\.', '/') + (it.endsWith('*') ? '' : '*')
}
}
}
}
// Ensure source code is published to Artifactory
// Have to redefine publishing with new name as Accelerator Plugin already defined mavenJava
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier 'sources'
}
publishing {
publications {
mavenJava2(MavenPublication) {
from components.java
artifact(sourceJar) {
classifier = 'sources'
}
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = "${artifactory_projectRepoKey}"
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications('mavenJava2')
}
}
}
artifactoryPublish {
dependsOn jar
}
detekt {
version = detektVersion
profile("main") {
input = "$projectDir/src"
config = "$projectDir/detekt.yml"
filters = ".*/resources/.*,.*/tmp/.*"
output = "$project.buildDir/reports/detekt"
}
}
check.dependsOn detektCheck
Good news: there is a new kotlinx-kover Gradle plugin, compatible with JaCoCo and IntelliJ.
plugins {
id("org.jetbrains.kotlinx.kover") version "0.5.0"
}
Once applied, the plugin can be used out of the box without additional configuration.
Watch its YouTube announcement video and also track its roadmap from this youtrack issue.
As said in the video, it solves the problem with inline functions and more.