Home > front end >  Gradle "Couldn't replace placeholder" on build
Gradle "Couldn't replace placeholder" on build

Time:05-30

I'm having a JavaFX project configured with Gradle in IntelliJ. Whenever I'm trying to run gradlew.bat clean build or simply the build task directly from IntelliJ, this is what I receive:

> Task :startScripts FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':startScripts'.
> Couldn't replace placeholder in E:\git\yuber\build\scripts\yuber

I'm also using the shadowJar plugin, which actually works when I'm trying to create a jar file and run it. And it works perfectly. Although, I'm not sure why it won't build. Looked everywhere for an answer, but seems that no one actually had this problem at this moment?

This is my build.gradle file:

plugins {
    id 'java'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.10'
    id 'org.beryx.jlink' version '2.24.1'
    id "com.github.johnrengelman.shadow" version "7.1.2"
}

group 'com.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

ext {
    junitVersion = '5.8.2'
}

sourceCompatibility = '11'
targetCompatibility = '11'

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

application {
    mainModule = 'com.example.yuber'
    mainClass = 'com.example.yuber.Launcher'
}

javafx {
    version = '11.0.2'
    modules = ['javafx.controls', 'javafx.fxml', 'javafx.web']
}

dependencies {
    implementation('org.controlsfx:controlsfx:11.1.0')
    implementation('com.dlsc.formsfx:formsfx-core:11.3.2') {
        exclude(group: 'org.openjfx')
    }
    implementation('net.synedra:validatorfx:0.1.13') {
        exclude(group: 'org.openjfx')
    }
    implementation('org.kordamp.ikonli:ikonli-javafx:12.2.0')
    implementation('org.kordamp.bootstrapfx:bootstrapfx-core:0.4.0')
    implementation('eu.hansolo:tilesfx:11.48') {
        exclude(group: 'org.openjfx')
    }
    implementation 'org.json:json:20220320'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.2.2'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.13.2'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.2'
    implementation 'junit:junit:4.13.1'

    testImplementation("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
}

test {
    useJUnitPlatform()
}

jlink {
    imageZip = project.file("${buildDir}/distributions/app-${javafx.platform.classifier}.zip")
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'app'
    }
}

jlinkZip {
    group = 'distribution'
}

CodePudding user response:

Updating the org.openjfx.javafxplugin (https://plugins.gradle.org/plugin/org.openjfx.javafxplugin) to the latest version inside build.gradle (from 0.0.10, as IntelliJ added it, to 0.0.13) seemed to have fixed the problem.

  • Related