Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.
This repository was archived by the owner on Jun 22, 2022. It is now read-only.

[Gradle / shadowJar] Could not resolve org.kodein.db:kodein-leveldb:0.8.1-beta. #48

Description

@KaiseiYokoyama

Hello,
I'm creating Minecraft's mod, and I want to use kodein-db for recording.
But gradle shadowJar doesn't work.

I appreciate your help and your work.

Here's an error message and build.gradle.

Gradle: v7.2

  • Error message of gradle shadowJar
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':shadow'.
   > Could not resolve org.kodein.db:kodein-leveldb:0.8.1-beta.
     Required by:
         project : > org.kodein.db:kodein-db-jvm:0.8.1-beta
         project : > org.kodein.db:kodein-leveldb-jni-jvm:0.8.1-beta > org.kodein.db:kodein-leveldb-jni-jvm-linux:0.8.1-beta
         project : > org.kodein.db:kodein-leveldb-jni-jvm:0.8.1-beta > org.kodein.db:kodein-leveldb-jni-jvm-macos:0.8.1-beta
         project : > org.kodein.db:kodein-leveldb-jni-jvm:0.8.1-beta > org.kodein.db:kodein-leveldb-jni-jvm-windows:0.8.1-beta
      > Cannot choose between the following variants of org.kodein.db:kodein-leveldb:0.8.1-beta:
          - debugRuntimeElements-published
          - jvmRuntimeElements-published
          - releaseRuntimeElements-published
        All of them match the consumer attributes:
          - Variant 'debugRuntimeElements-published' capability org.kodein.db:kodein-leveldb:0.8.1-beta:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'debug' but the consumer didn't ask for it
                  - Provides com.android.build.api.attributes.VariantAttr 'debug' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it
          - Variant 'jvmRuntimeElements-published' capability org.kodein.db:kodein-leveldb:0.8.1-beta:
              - Unmatched attributes:
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
          - Variant 'releaseRuntimeElements-published' capability org.kodein.db:kodein-leveldb:0.8.1-beta:
              - Unmatched attributes:
                  - Provides com.android.build.api.attributes.BuildTypeAttr 'release' but the consumer didn't ask for it
                  - Provides com.android.build.api.attributes.VariantAttr 'release' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
                  - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  • build.gradle
buildscript {
    ext.kotlin_version = '1.5.21'
    repositories {
        jcenter()
        mavenCentral()
        maven { url = 'https://maven.minecraftforge.net' }
        maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.+', changing: true
        classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    id 'com.github.johnrengelman.shadow' version '7.1.0'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'kotlin'
apply plugin: 'org.spongepowered.mixin'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'

version = "0.1.0-1.16.3"
group = "com.kyokoyama" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "joyflick"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.

mixin {
    add sourceSets.main, "joyflick.refmap.json"
    add sourceSets.main, "expmanager.refmap.json"
}

minecraft {
    mappings channel: 'snapshot', version: '20201028-1.16.3'
    
    accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

    runs {
        client {
            workingDirectory project.file('run')
            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'
            arg "-mixin.config=expmanager.mixins.json"
            arg "-mixin.config=joyflick.mixins.json"
            mods {
                joyflick {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')
            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'
            arg "-mixin.config=expmanager.mixins.json"
            arg "-mixin.config=joyflick.mixins.json"
            mods {
                joyflick {
                    source sourceSets.main
                }
            }
        }

        data {
            workingDirectory project.file('run')
            property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
            property 'forge.logging.console.level', 'debug'
            args '--mod', 'joyflick', '--all', '--output', file('src/generated/resources/')
            mods {
                joyflick {
                    source sourceSets.main
                }
            }
        }
    }
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
    maven {
        // location of the maven that hosts JEI files
        name = "Progwml6 maven"
        url = "https://dvs1.progwml6.com/files/maven/"
    }
    maven {
        // location of a maven mirror for JEI files, as a fallback
        name = "ModMaven"
        url = "https://modmaven.k-4u.nl"
    }
    maven {
        url = "https://www.cursemaven.com"
    }
    mavenCentral()
    maven {
        name = 'kotlinforforge'
        url = 'https://thedarkcolour.github.io/KotlinForForge/'
    }
}

allprojects {
    repositories {
        google()
        maven { url = "https://jitpack.io" }
    }
}

//configurations {
//    shade
//    shadow
//}

dependencies {
    minecraft 'net.minecraftforge:forge:1.16.3-34.1.42'
//    implementation fg.deobf("mezz.jei:jei-1.16.3:7.6.0.51")
    runtimeOnly fg.deobf("curse.maven:controllable-317269:3335987")
    compileOnly fg.deobf("curse.maven:controllable-317269:3335987")
//    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    runtimeOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
//    implementation 'thedarkcolour:kotlinforforge:1.15.1'
    runtimeOnly 'thedarkcolour:kotlinforforge:1.15.1'
    compileOnly 'thedarkcolour:kotlinforforge:1.15.1'

    // reflection
    shadow "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//    shade "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

    shadow "com.github.KaiseiYokoyama:JoyFlickMODRecord:v1.11"
//    shade "com.github.KaiseiYokoyama:JoyFlickMODRecord:v1.11"

    // kodein-db

    shadow "org.kodein.db:kodein-db-jvm:0.8.1-beta"
    shadow "org.kodein.db:kodein-db-serializer-kotlinx:0.8.1-beta"
    shadow "org.kodein.db:kodein-leveldb-jni-jvm:0.8.1-beta"

//    shade "org.kodein.db:kodein-db-jvm:0.8.1-beta"
//    shade "org.kodein.db:kodein-db-serializer-kotlinx:0.8.1-beta"
//    shade "org.kodein.db:kodein-leveldb-jni-jvm:0.8.1-beta"

    shadow "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
    shadow "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.2.1"
    shadow "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
    shadow "org.jsoup:jsoup:1.14.2"
    shadow 'org.jetbrains.kotlinx:kotlinx-datetime:0.3.0'

//    shade "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.1"
//    shade "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.2.1"
//    shade "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
//    shade "org.jsoup:jsoup:1.14.2"
//    shade 'org.jetbrains.kotlinx:kotlinx-datetime:0.3.0'

    testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
}

jar {
    manifest {
        attributes([
                "Specification-Title"     : "JoyFlick",
                "Specification-Vendor"    : "Kaisei Yokoyama",
                "Specification-Version"   : "1",
                "Implementation-Title"    : project.name,
                "Implementation-Version"  : "${version}",
                "Implementation-Vendor"   : "Kaisei Yokoyama",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
                "Signing-Fingerprint"     : project.hasProperty('fingerprint') ? project.property('fingerprint') : 'unsigned',
                "MixinConfigs"            : "joyflick.mixins.json,expmanager.mixins.json"
        ])
    }
}

shadowJar {
    archiveClassifier.set('')

    project.configurations.shadow.setCanBeResolved(true)
    configurations = [project.configurations.shadow]
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

// https://qiita.com/MirrgieRiana/items/a006a0fbe21e30a2f7a2
reobf {
    shadowJar {}
}
tasks.shadowJar.finalizedBy('reobfShadowJar')

artifacts {
    archives shadowJar
}

test {
    // JUnit platform を使う設定
    useJUnitPlatform()

    testLogging {
        // テスト時の標準出力と標準エラー出力を表示する
        showStandardStreams true
        // イベントを出力する (TestLogEvent)
        events 'started', 'skipped', 'passed', 'failed'
        // 例外発生時の出力設定 (TestExceptionFormat)
        exceptionFormat 'full'
    }
}

//Properties keyStoreProperties = new Properties()
//File file = new File("C:\\dev\\keystore.properties")
//if (file.exists()) {
//    InputStream ins = new FileInputStream(file)
//    keyStoreProperties.load(ins)
//    ins.close()
//}

compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions