gradle-kotlin-dsl

How to specify the entry point, Main-Class, for a FatJar using Gradle Kotlin DSL?

百般思念 提交于 2020-01-11 13:24:33
问题 How do I specify the Main-Class attribute in the ShadowJar once it's imported? import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { kotlin("jvm") version "1.2.51" id("com.github.johnrengelman.shadow") version "2.0.4" } group = "xxx.yyy" version = "1.0-SNAPSHOT" repositories { mavenCentral() } dependencies { implementation(kotlin("stdlib-jdk8")) } tasks.withType<KotlinCompile> { kotlinOptions.jvmTarget = "1.8" }

How to access variant.outputFileName in Kotlin

ⅰ亾dé卋堺 提交于 2020-01-11 02:05:07
问题 We've been using a snippet like this one to rename the APK file generated by our Gradle build: android.applicationVariants.all { variant -> variant.outputs.all { outputFileName = "${variant.name}-${variant.versionName}.apk" } } Source: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration#variant_output I am now in the process of converting my build.gradle to build.gradle.kts , i. e. to the Gradle Kotlin DSL. This is one of the last missing pieces: I can't figure out how to

Unresolved reference: sourceSets for Gradle Kotlin DSL

放肆的年华 提交于 2020-01-01 09:23:11
问题 Trying to migrate my existing build.gradle to Kotlin and I am getting the following error in my project: Script compilation error: Line 86: from(sourceSets["main"].allSource) ^ Unresolved reference: sourceSets 1 error The error is coming from my subprojects block when I try to define the sourcesJar task: subprojects { val sourcesJar by tasks.registering(Jar::class) { classifier = "sources" from(sourceSets["main"].allSource) // error here } configure<PublishingExtension> { publications {

Unresolved reference: sourceSets for Gradle Kotlin DSL

ε祈祈猫儿з 提交于 2020-01-01 09:23:11
问题 Trying to migrate my existing build.gradle to Kotlin and I am getting the following error in my project: Script compilation error: Line 86: from(sourceSets["main"].allSource) ^ Unresolved reference: sourceSets 1 error The error is coming from my subprojects block when I try to define the sourcesJar task: subprojects { val sourcesJar by tasks.registering(Jar::class) { classifier = "sources" from(sourceSets["main"].allSource) // error here } configure<PublishingExtension> { publications {

Can't use project extra properties in plugin block

寵の児 提交于 2019-12-30 18:54:10
问题 I have a multi-project build, and more often than not I find myself locking versions for artifacts across the board. So in my root project I define something like: project.extra.set("pkgVersions", mapOf( "kotlin" to "1.2.0", "jooq" to "3.10.2" )) val pkgVersions : Map<String, String> by project.extra plugins { base kotlin("jvm") version "1.2.0" apply false } While I can use pkgVersions anywhere, including other subprojects: val pkgVersions by rootProject.extra jooq { version = pkgVersions[

Kotlin and Gradle - Reading from stdio

偶尔善良 提交于 2019-12-30 09:36:45
问题 I am trying to execute my Kotlin class using the command: ./gradlew -q run < src/main/kotlin/samples/input.txt Here is my HelloWorld.kt class: package samples fun main(args: Array<String>) { println("Hello, world!") val lineRead = readLine() println(lineRead) } Here is my build.gradle.kts : plugins { kotlin("jvm") application } application { mainClassName = "samples.HelloWorldKt" } dependencies { compile(kotlin("stdlib")) } repositories { jcenter() } The code executes, but the data contained

Could not find javax.xml.xquery:xqj-api:1.0

拥有回忆 提交于 2019-12-25 03:42:57
问题 The maven repo is added correctly, and is required? If so, what's the syntax to add xqj ? exception: thufir@dur:~/NetBeansProjects/helloWorldBaseX$ thufir@dur:~/NetBeansProjects/helloWorldBaseX$ gradle clean run > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileJava'. > Could not resolve all files for configuration ':compileClasspath'. > Could not find javax.xml.xquery:xqj-api:1.0. Searched in the following locations: -

Gradle Kotlin: Could not find net.sf.saxon:saxon-HE:9.9.0-2

穿精又带淫゛_ 提交于 2019-12-25 02:46:11
问题 Saxon doesn't seem to be where gradle is trying to send it: Not Found For request 'GET /artifact/net/sf/saxon/saxon-HE/9.9.0-2/saxon-HE-9.9.0-2.pom' The actual URL is, or looks to be, ../artifact/net.sf.saxon/.. rather than ..artifact/net/saxon.. which causes a problem. How do I tell the kotlin-gradle-dsl , specifically, which repo to look in and how to look in that repo? kotlin build file: // https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE compile group: 'net.sf.saxon', name: 'Saxon

how to get Eclipse to correctly open a gradle project?

北城以北 提交于 2019-12-25 00:12:51
问题 Both Kotlin and Gradle installed fine through the marketplace: And I've right clicked the project "refresh dependencies" from the Gradle context menu: what else can I do to get Eclipse to load this project? Despite the errors from Eclipse, it runs fine from the console: thufir@dur:~/eclipse-workspace/baseX$ thufir@dur:~/eclipse-workspace/baseX$ gradle clean run > Task :run Oct. 06, 2019 7:58:19 P.M. org.basex.examples.local.LoadXML <init> INFO: {databaseName=books, dataResource=books.xml} Oct

how to correct red “import” error messages from Eclipse?

家住魔仙堡 提交于 2019-12-24 19:05:39
问题 I created a project using gradle init --type java-application --test-framework testng --dsl kotlin but Eclipse shows: For what it's worth, this runs fine: thufir@dur:~/eclipse-workspace/baseX$ thufir@dur:~/eclipse-workspace/baseX$ gradle clean run > Task :run Oct. 06, 2019 6:35:33 P.M. org.basex.examples.local.LoadXML <init> INFO: {databaseName=books, dataResource=books.xml} Oct. 06, 2019 6:35:34 P.M. org.basex.examples.local.LoadXML createDrop INFO: Name Resources Size Input Path -----------