Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with MixinGradle during build #113

Open
verityw opened this issue Jan 19, 2024 · 10 comments
Open

Problem with MixinGradle during build #113

verityw opened this issue Jan 19, 2024 · 10 comments

Comments

@verityw
Copy link

verityw commented Jan 19, 2024

I see in build.gradle, there is this section that's also in the Malmo build.gradle file:

dependencies {
        classpath 'org.ow2.asm:asm:6.0'
        classpath('com.github.SpongePowered:MixinGradle:dcfaf61'){ // 0.6
            // Because forgegradle requires 6.0 (not -debug-all) while mixingradle depends on 5.0
            // and putting mixin right here will place it before forge in the class loader
            exclude group: 'org.ow2.asm', module: 'asm-debug-all'
        }
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
        // or 'com.github.yunfanjiang:ForgeGradle:FG_2.2_patched-SNAPSHOT'
    }

However, when running their basic validate_install.py script, it yields:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'Minecraft'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.github.SpongePowered:MixinGradle:dcfaf61.
     Searched in the following locations:
       - https://jitpack.io/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.pom
       - https://jitpack.io/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.jar
       - https://jcenter.bintray.com/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.pom
       - https://jcenter.bintray.com/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.jar
       - https://repo.maven.apache.org/maven2/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.pom
       - https://repo.maven.apache.org/maven2/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.jar
       - https://maven.minecraftforge.net/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.pom
       - https://maven.minecraftforge.net/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.jar
       - https://oss.sonatype.org/content/repositories/snapshots/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.pom
       - https://oss.sonatype.org/content/repositories/snapshots/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.jar
       - https://plugins.gradle.org/m2/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.pom
       - https://plugins.gradle.org/m2/com/github/SpongePowered/MixinGradle/dcfaf61/MixinGradle-dcfaf61.jar
     Required by:
         project :

Has the repo for com.github.SpongePowered:MixinGradle:dcfaf61 been changed or something? How can I fix this?

Likewise, is there a way to prevent new builds / do offline builds after successfully building once? I've had a lot of times where MineDojo just stops working randomly due to build issues that didn't exist prior. Being able to do this would really aid in replicability and overall usability of the simulator...

@verityw
Copy link
Author

verityw commented Jan 24, 2024

I found that I had a cached copy of the requisite jar file, which I am hosting on GitHub here: https://github.com/verityw/MixinGradle-dcfaf61

After cloning, in the build.gradle file, add this to the repositories{} section:

maven {
            url 'file:/path/to/that/repo's/parent'
        }

Then, change the classpath for MixinGradle to:

classpath('MixinGradle-dcfaf61:MixinGradle:dcfaf61'){ // 0.6
            // Because forgegradle requires 6.0 (not -debug-all) while mixingradle depends on 5.0
            // and putting mixin right here will place it before forge in the class loader
            exclude group: 'org.ow2.asm', module: 'asm-debug-all'
        }

Hopefully the actual URL gets fixed soon though!

EDIT: note that MixinGradle-dcfaf61:MixinGradle:dcfaf61 means "append MixinGradle-dcfaf61/MixinGradle/dcfaf61 to each of the repository paths you listed to see if the file exists" meaning that the url should be to the repo's parent UwU

@Rubyboat1207
Copy link

Rubyboat1207 commented Feb 2, 2024

I am using the docker install, anyone know where the java project is?

edit: i managed to find it at /opt/conda/lib/python3.9/site-packages/minedojo/sim/Malmo/Minecraft

@MatthewZhang473
Copy link

Thank you, this really helped.@verityw

@zzyunzhi
Copy link

Hi @verityw would it be possible to provide the full modified build.gradle file as well for reference? Thanks a lot.

@GF-Huang
Copy link

GF-Huang commented Feb 28, 2024

Hi @verityw would it be possible to provide the full modified build.gradle file as well for reference? Thanks a lot.

The /path/to/that/repo is misleading.

In fact, it is:

maven {
    url 'file:///path/to/that/repo's/parent'
}

In my case is:

maven {
    url 'file:///home/huang'
}

My folder layout:

image
image

@verityw
Copy link
Author

verityw commented Feb 28, 2024

ya that

@XuyaoWang
Copy link

Hi @verityw would it be possible to provide the full modified build.gradle file as well for reference? Thanks a lot.

There is another way to solve.

  1. Clone the rep to your local folder, any position is ok.
  2. Find the build.gradle. my file path is minedojo/sim/Malmo/Minecraft/build.gradle. If your project has been developed based on Minedojo, you can use 'find ~/ -name build.gradle' instruction to find your coorsponding file.
  3. Modify your build.gradle from
buildscript {
    repositories {

        maven { url 'https://jitpack.io' }
        jcenter()
        mavenCentral()
        maven {
            name = "forge"
            url = "https://maven.minecraftforge.net/"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'org.ow2.asm:asm:6.0'
        classpath('com.github.SpongePowered:MixinGradle:dcfaf61'){ // 0.6
            // Because forgegradle requires 6.0 (not -debug-all) while mixingradle depends on 5.0
            // and putting mixin right here will place it before forge in the class loader
            exclude group: 'org.ow2.asm', module: 'asm-debug-all'
        }

        classpath 'com.github.yunfanjiang:ForgeGradle:FG_2.2_patched-SNAPSHOT'
    }

to

buildscript {
    repositories {

        maven { url 'https://jitpack.io' }
        jcenter()
        mavenCentral()
        maven {
            name = "forge"
            url = "https://maven.minecraftforge.net/"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'org.ow2.asm:asm:6.0'
//         classpath('com.github.SpongePowered:MixinGradle:dcfaf61'){ // 0.6
//             // Because forgegradle requires 6.0 (not -debug-all) while mixingradle depends on 5.0
//             // and putting mixin right here will place it before forge in the class loader
//             exclude group: 'org.ow2.asm', module: 'asm-debug-all'
//         }

        classpath fileTree(dir: absolute path to your MixinGradle file, include: '*.jar')

        classpath 'com.github.yunfanjiang:ForgeGradle:FG_2.2_patched-SNAPSHOT'
    }

For me, the content of fileTree is

classpath fileTree(dir: '/home/yao/Documents/MineDojo/minedojo/sim/Malmo/Minecraft/MixinGradle-dcfaf61/MixinGradle/dcfaf61/', include: '*.jar')

@GF-Huang
Copy link

GF-Huang commented Mar 7, 2024

@XuyaoWang How should I fix this by your solution?

Caused by run: python scripts\validate_install.py:

image

@XuyaoWang
Copy link

@GF-Huang

Sorry I didn't encounter the issue you mentioned. After resolving MixinGradle using the method I mentioned earlier, my program runs smoothly. However, one thing different from your approach is that I found most of the issues here stem from the Minecraft simulator.

First, I used minedojo/sim/Malmo/Minecraft/launchClient.sh to download Minecraft dependencies, then I successfully ran the Minecraft simulator, which brought up the game's start interface on my desktop, and finally executed validate_install.py. Running validate_install.py was successful once, and the game's running interface appeared successfully.

@AkagawaTsurunaki
Copy link

Don't forget to edit the build.gradle in your dist-package directory.
For me, it is //usr/local/lib/python3.9/dist-packages/minedojo/sim/Malmo/Minecraft/build.gradle
Only editing build.gradle in your project directory will not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants