How can I make “gradle –stacktrace” the default?

Not in gradle.properties but in build.gradle itself. Add the following piece of code at the very beginning of the build script: import org.gradle.logging.ShowStacktrace gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS throw new RuntimeException(‘lol’) Or in Android Studio: import org.gradle.api.logging.configuration.ShowStacktrace gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS It also might be put in init script. As pointed out in the comments, from gradle v. … Read more

What is the gradle equivalent of maven’s exec plugin for running Java apps?

The easiest solution is to use the Application Plugin, which among other things provides a run task. To make the main class configurable from the command line, you’ll have to set mainClassName to the value of some system (or project) property, and then pass that property from the command line: apply plugin: “application” mainClassName = … Read more

Gradle7 Version Catalog: How to use it with buildSrc?

With Gradle 7.3.3, it is possible. Note version catalogs are GA since Gradle 7.4 The code snippet assumes Gradle is at least 7.4, but if you need them prior that version, insert enableFeaturePreview(“VERSION_CATALOGS”) at the beginning of each settings.gradle.kts. Using buildSrc buildSrc/settings.gradle.kts dependencyResolutionManagement { versionCatalogs { create(“libs”) { from(files(“../gradle/libs.versions.toml”)) } } } buildSrc/build.gradle.kts dependencies { … Read more

Boilerplate project configuration in Gradle with Gradle Kotlin DSL

If you want to benefit from all the Gradle Kotlin DSL goodness you should strive to apply all plugins using the plugins {} block. See https://github.com/gradle/kotlin-dsl/blob/master/doc/getting-started/Configuring-Plugins.md You can manage plugin repositories and resolution strategies (e.g. their version) in your settings files. Starting with Gradle 4.4 this file can be written using the Kotlin DSL, aka … Read more

Gradle dependency versions ‘+’ sign

In this scenario, if version 1.21 exists and is the latest version, I would like to fail, since I want greater than or equal to 1.22, but 1.2+ will look for >= 1.20. How can I specify this? Is this possible? I don’t think there is any documentation about this, but since Gradle originally used … Read more

Gradle basedir property

Depending on your exact needs, you could use buildFile.parent or projectDir. (The build file path defaults to “$projectDir/build.gradle” and can be reconfigured in settings.gradle.) See the Gradle Build Language Reference for which properties and methods are available on Project and other classes.

proper way to run kotlin application from gradle task

Thanks to the link how to run compiled class file in Kotlin? provided by @JaysonMinard that main @file:JvmName(“Example”) package com.lapots.game.journey.ims.example fun main(args: Array<String>) { print(“executable!”) } and that task task runExample(type: JavaExec) { main = ‘com.lapots.game.journey.ims.example.Example’ classpath = sourceSets.main.runtimeClasspath } did the trick

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