atsushieno / ktmidi

Kotlin multiplatform library for MIDI access abstraction and data processing for MIDI 1.0, MIDI 2.0, SMF, SMF2 (MIDI Clip File), and MIDI-CI.
MIT License
68 stars 7 forks source link

org.bytedeco:javacpp:1.5.10 not found with 0.8.2 #79

Closed FDelporte closed 3 months ago

FDelporte commented 4 months ago

When bumping my application from 0.8.0-pre to 0.8.2 I get the following error output:

Could not create task ':startScripts'.
Could not create task ':jar'.
Could not resolve all files for configuration ':runtimeClasspath'.
Could not find javacpp-1.5.10-android-arm.jar (org.bytedeco:javacpp:1.5.10).
Searched in the following locations:
    https://repo.maven.apache.org/maven2/org/bytedeco/javacpp/1.5.10/javacpp-1.5.10-android-arm.jar

With version 0.8.1 this error is not thrown.

atsushieno commented 3 months ago

Thanks for trying it out. I'm not seeing your project sources so it is all my guess but:

If it was compiling without error on v0.8.0-preN and v0.8.1, then those versions are wrong. Maybe try removing such package references from your project?

FDelporte commented 3 months ago

Very strange... this is my gradle file and the error pops up if I only change the ktmidi version from 0.8.1 to 0.8.2 ... My app is intended for desktop only, so I have no Android dependencies.

object Versions {
    const val atlantafx = "2.0.1"
    const val charts = "21.0.7"
    const val fxgl = "21.1"
    const val kotlinCoroutines = "1.8.1"
    const val kotlinSerialization = "1.6.3"
    const val ktmidi = "0.8.1"
    const val log4j = "2.23.1"
}

plugins {
    java
    id("org.jetbrains.kotlin.jvm") version "2.0.0"
    id("org.openjfx.javafxplugin") version "0.0.10"
    kotlin("plugin.serialization") version "1.9.23"
    application
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("com.github.almasb:fxgl:${Versions.fxgl}")
    implementation("dev.atsushieno:ktmidi:${Versions.ktmidi}")
    implementation("dev.atsushieno:ktmidi-jvm:${Versions.ktmidi}")
    implementation("dev.atsushieno:ktmidi-jvm-desktop:${Versions.ktmidi}")
    implementation("eu.hansolo.fx:charts:${Versions.charts}")
    implementation("io.github.mkpaz:atlantafx-base:${Versions.atlantafx}")
    implementation("org.apache.logging.log4j:log4j-core:${Versions.log4j}")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinSerialization}")

    // Add Kotlin runtime dependency
    implementation("org.jetbrains.kotlin:kotlin-stdlib")

    testImplementation("org.jetbrains.kotlin:kotlin-test")
}

javafx {
    version = "21.0.2"
    modules("javafx.controls", "javafx.fxml", "javafx.media")
}

application {
    mainClass.set("be.codewriter.melodymatrix.AppLauncher")
}

tasks.jar {
    manifest {
        attributes(
            "Main-Class" to application.mainClass.get()
        )
    }

    archiveBaseName.set("MelodyMatrix")

    // Include Kotlin runtime dependencies
    from(configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) })

    // Set duplicates handling strategy
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
FDelporte commented 3 months ago

Version 1.5.10 indeed doesn't exist on https://repo.maven.apache.org/maven2/org/bytedeco/javacpp/, but it's used in this file in the ktmidi project: https://github.com/atsushieno/ktmidi/blob/main/settings.gradle#L30

atsushieno commented 3 months ago

1.5.10 is indeed released (it's shown between 1.5.1 and 1.5.2 as 1.5.10 should be there string comparison wise...!). The problem lies elsewhere...

FDelporte commented 3 months ago

auch, my mistake, it's indeed in the list :-)

atsushieno commented 3 months ago

Okay, when you use ktmidi-jvm-desktop you need another Gradle plugin besides what you already have:

    id("org.bytedeco.gradle-javacpp-platform") version "1.5.10"

It replaces the references to all those javacpp platforms with whatever required only for the platform.

I will add a note on README.md so that we do not get lost there.

FDelporte commented 3 months ago

Thanks, the dependency problem is solved indeed with this plugin!