Problem with gradle dependency [Solved]

Started by Marelo on

Topic category: Troubleshooting, bugs, and solutions

Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Problem with gradle dependency [Solved]
Thu, 08/19/2021 - 14:11 (edited)

Hi, i'm new at modding and, on a new project I'm doing, I run into a problem, so basically i would like to know how i could put a gradle dependency ( which is pulled from maven central repository ) into a final distribuition build of the mod ( the final .jar file ).

Edited by Marelo on Thu, 08/19/2021 - 14:11
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I found something about…
Mon, 08/09/2021 - 17:56

I found something about shadow gradle project on internet recently, but i don't know how I could add a Third-party api, and then shadow this API into the final jar.

 

My build.gradle looks like this

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
        classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
    }
}

apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'

version = '1.0'
group = 'com.yourname.modid'
archivesBaseName = 'modid'

java.toolchain.languageVersion = JavaLanguageVersion.of(8)


minecraft {
    mappings channel: 'snapshot', version: '20201028-1.16.3'

    runs {
        client {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'
            property 'forge.logging.console.level', 'debug'

            mods {
                examplemod {
                    source sourceSets.main
                }
            }
        }
    }
}


dependencies {
    minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'
    implementation group: 'com.microsoft.playwright', name: 'playwright', version: '1.13.0'
}


apply from: 'mcreator.gradle'