Publish Snapshot vs Publish Release in Gradle With Continuous Integration

You can configure the snapshot and the release repository in the ‘Upload’ task (e.g. the uploadArchives) task: uploadArchives { repositories { mavenDeployer { repository(url: ‘http://myCompanyRepo.com:8081/releases’) { authentication(userName: ‘admin’, password: ‘password’); } snapshotRepository(url: ‘http://myCompanyRepo.com:8081/snapshots’) { authentication(userName: ‘admin’, password: ‘password’); } } } } For *-SNAPSHOT versions the snapshotRepository is used. Otherwise the releases repo is used.

How do I use the native JUnit 5 support in Gradle with the Kotlin DSL?

[Edit april 2019] As Pedro has found, three months after I asked this question Gradle actually created a user guide for the Kotlin DSL which can be visited at https://docs.gradle.org/current/userguide/kotlin_dsl.html They also added a migration guide from Groovy to Kotlin at https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/ Answer: The syntax you ask for is tasks.test { // Use the built-in … Read more

JUnit5 tag-specific gradle task

Based on https://github.com/gradle/gradle/issues/6172#issuecomment-409883128 Amended in 2020 to take lazy task configuration and Gradle 5 into account. See answer’s history for older versions. plugins { id “java” } def test = tasks.named(“test”) { useJUnitPlatform { excludeTags “integration” } } def integrationTest = tasks.register(“integrationTest2”, Test) { useJUnitPlatform { includeTags “integration” } shouldRunAfter test } tasks.named(“check”) { dependsOn … Read more

Why is my Gradle task always running?

It is very important to understand the distinction between task configuration and task execution: task eclipsify { // Code that goes here is *configuring* the task, and will // get evaluated on *every* build invocation, no matter // which tasks Gradle eventually decides to execute. // Don’t do anything time-consuming here. doLast { // `doLast` … Read more

Gradle exec task returns non-zero exit value and fails the build but I want to not fail and instead perform another task

TL;DR – Use ignoreExitValue = true When I read the documentation for about the fiftieth time, I finally saw that there is a property, ignoreExitValue, which defaults to false. But if you set it to true, you can then perform your own tasks in the doLast block. task myTask(type:Exec) { workingDir ‘.’ commandLine ‘./myscript.sh’ ignoreExitValue … Read more

providedCompile without war plugin

There is no such configuration out of the box for the java plugin. However you can build it yourself as follows: configurations { providedCompile } dependencies { providedCompile “javax.servlet:javax.servlet-api:3.+” } sourceSets.main.compileClasspath += configurations.providedCompile sourceSets.test.compileClasspath += configurations.providedCompile sourceSets.test.runtimeClasspath += configurations.providedCompile This adds the configuration, and puts all the dependencies in there on the compile classpaths of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)