Jump to content

[SOLVED] How to build mod with dependencies?


IvanSteklow

Recommended Posts

I need help with my API building. When I run gradlew build, I have this window:

 

[embed=425,349]C:\Users\IvanSteklow\Documents\Mods\RealUtils>gradlew build

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14/userguide/gradle_daemon.

html.

#################################################

        ForgeGradle 2.2-SNAPSHOT-f1643ac

  https://github.com/MinecraftForge/ForgeGradle

#################################################

              Powered by MCP unknown

            http://modcoderpack.com

        by: Searge, ProfMobius, Fesh0r,

        R4wk, ZeuX, IngisKahn, bspkrs

#################################################

:deobfCompileDummyTask

:deobfProvidedDummyTask

:sourceApiJava UP-TO-DATE

:compileApiJava UP-TO-DATE

:processApiResources UP-TO-DATE

:apiClasses UP-TO-DATE

:sourceMainJava UP-TO-DATE

:compileJava

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:15: error: package ru.ivansteklow.isdev doe

s not exist

import ru.ivansteklow.isdev.Notifier;

                          ^

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModBlocks.java:5: error: package ru.ivansteklow.isdev d

oes not exist

import ru.ivansteklow.isdev.BlockRegisterer;

                          ^

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModCraftManager.java:9: error: package ru.ivansteklow.i

sdev does not exist

import ru.ivansteklow.isdev.Notifier;

                          ^

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModFood.java:8: error: package ru.ivansteklow.isdev doe

s not exist

import ru.ivansteklow.isdev.ItemRegisterer;

                          ^

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModItems.java:6: error: package ru.ivansteklow.isdev do

es not exist

import ru.ivansteklow.isdev.ItemRegisterer;

                          ^

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:30: error: cannot find symbol

                Notifier.info("Real Utils started successful!", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:33: error: cannot find symbol

                Notifier.info("Items initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:36: error: cannot find symbol

                Notifier.info("Food initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:37: error: cannot find symbol

                Notifier.info("Blocks initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:41: error: cannot find symbol

                Notifier.info("Recipes initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:48: error: cannot find symbol

                Notifier.info("Render models initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:60: error: cannot find symbol

                Notifier.info("Real Utils started on server successful!", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:61: error: cannot find symbol

                Notifier.info("Items initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:62: error: cannot find symbol

                Notifier.info("Food initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:63: error: cannot find symbol

                Notifier.info("Recipes initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\client\Main.java:64: error: cannot find symbol

                Notifier.info("Render models initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class Main

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModBlocks.java:19: error: cannot find symbol

                        BlockRegisterer.regRender(nyWool, Refs.MOD_ID);

                        ^

  symbol:  variable BlockRegisterer

  location: class ModBlocks

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModCraftManager.java:14: error: cannot find symbol

                Notifier.info("Shaped recipes initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class ModCraftManager

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModCraftManager.java:16: error: cannot find symbol

                Notifier.info("Shapeless recipes initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class ModCraftManager

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModCraftManager.java:18: error: cannot find symbol

                Notifier.info("Smelting recipes initialized and registered.", Refs.MOD_NAME);

                ^

  symbol:  variable Notifier

  location: class ModCraftManager

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModFood.java:35: error: cannot find symbol

                ItemRegisterer.regRender(stackedStew, Refs.MOD_ID);

                ^

  symbol:  variable ItemRegisterer

  location: class ModFood

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModFood.java:36: error: cannot find symbol

                ItemRegisterer.regRender(stackedBeetroot, Refs.MOD_ID);

                ^

  symbol:  variable ItemRegisterer

  location: class ModFood

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModFood.java:37: error: cannot find symbol

                ItemRegisterer.regRender(stackedRabbit, Refs.MOD_ID);

                ^

  symbol:  variable ItemRegisterer

  location: class ModFood

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModFood.java:38: error: cannot find symbol

                ItemRegisterer.regRender(bonedChicken, Refs.MOD_ID);

                ^

  symbol:  variable ItemRegisterer

  location: class ModFood

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModItems.java:27: error: cannot find symbol

                ItemRegisterer.regRender(bowlPlate, Refs.MOD_ID);

                ^

  symbol:  variable ItemRegisterer

  location: class ModItems

C:\Users\IvanSteklow\Documents\Mods\RealUtils\build\sources\main\java\ru\ivansteklow\RealUtils\init\ModItems.java:28: error: cannot find symbol

                ItemRegisterer.regRender(stackedBowl, Refs.MOD_ID);

                ^

  symbol:  variable ItemRegisterer

  location: class ModItems

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

26 errors

:compileJava FAILED

 

FAILURE: Build failed with an exception.

 

* What went wrong:

Execution failed for task ':compileJava'.

> Compilation failed; see the compiler error output for details.

 

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

BUILD FAILED

 

Total time: 59.521 secs

 

C:\Users\IvanSteklow\Documents\Mods\RealUtils>gradlew build

To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/2.14/userguide/gradle_daemon.

html.

#################################################

        ForgeGradle 2.2-SNAPSHOT-f1643ac

  https://github.com/MinecraftForge/ForgeGradle

#################################################

              Powered by MCP unknown

            http://modcoderpack.com

        by: Searge, ProfMobius, Fesh0r,

        R4wk, ZeuX, IngisKahn, bspkrs

#################################################

 

FAILURE: Build failed with an exception.

 

* What went wrong:

A problem occurred configuring root project 'RealUtils'.

> Only allowed to use maven dependencies for this. If its a jar file, deobfuscate it yourself.

 

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

 

BUILD FAILED

 

Total time: 28.657 secs[/embed]

 

 

This is my build.gradle file, I don't know how to configure it. I have API as a Eclipse project and as JAR-File:

 

[embed=425,349]buildscript {

    repositories {

        jcenter()

        maven { url = "http://files.minecraftforge.net/maven" }

    }

    dependencies {

        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'

    }

}

apply plugin: 'net.minecraftforge.gradle.forge'

//Only edit below this line, the above code adds and enables the nessasary things for Forge to be setup.

 

 

version = "1.1.0"

group= "ru.ivansteklow.RealUtils" // http://maven.apache.org/guides/mini/guide-naming-conventions.html

archivesBaseName = "realutils"

 

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

compileJava {

    sourceCompatibility = targetCompatibility = "1.8"

}

 

minecraft {

    version = "1.10.2-12.18.3.2185"

    runDir = "run"

   

    // the mappings can be changed at any time, and must be in the following format.

    // snapshot_YYYYMMDD  snapshot are built nightly.

    // stable_#            stables are built at the discretion of the MCP team.

    // Use non-default mappings at your own risk. they may not allways work.

    // simply re-run your setup task after changing the mappings to update your workspace.

    mappings = "snapshot_20161111"

    // makeObfSourceJar = true // an Srg named sources jar is made by default. uncomment this to disable.

}

 

dependencies {

     

    // you may put jars on which you depend on in ./libs

    // or you may define them like so..

    //compile "some.group:artifact:version:classifier"

    //compile "some.group:artifact:version"

     

    // real examples

    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env

    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

 

    // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.

    //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

 

    // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,

    // except that these dependencies get remapped to your current MCP mappings

    //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

 

    // for more info...

    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html

    // http://www.gradle.org/docs/current/userguide/dependency_management.html

 

}

 

processResources

{

    // this will ensure that this task is redone when the versions change.

    inputs.property "version", project.version

    inputs.property "mcversion", project.minecraft.version

 

    // replace stuff in mcmod.info, nothing else

    from(sourceSets.main.resources.srcDirs) {

        include 'mcmod.info'

               

        // replace version and mcversion

        expand 'version':project.version, 'mcversion':project.minecraft.version

    }

       

    // copy everything else, thats not the mcmod.info

    from(sourceSets.main.resources.srcDirs) {

        exclude 'mcmod.info'

    }

}

[/embed]

 

 

In code and in mcmod.info I wrote depend with API, API modid is isdev, path to Main file is - ru.ivansteklow.isdev, version 1.0.0

 

[move]HELP ME PLEASE[/move]

  • Like 1
Link to comment
Share on other sites

Hmm...

 

dependencies {
     
    // you may put jars on which you depend on in ./libs
    // or you may define them like so..
    //compile "some.group:artifact:version:classifier"
    //compile "some.group:artifact:version"
     
    // real examples
    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

    // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
    //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // the deobf configurations:  'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
    // except that these dependencies get remapped to your current MCP mappings
    //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
    //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'

    // for more info...
    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
    // http://www.gradle.org/docs/current/userguide/dependency_management.html

}

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

If I adds compile files('./libs/isdev-src.jar') is not working

 

    // real examples

    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Does the file "ru.ivansteklow.isdev:1.0.0:dev" exist adjacent to the gradle.build file, or is it in a subfolder?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Then--surprise surprise--you need to tell gradle the subfolder.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

...

compile 'libs/ru.ivansteklow.isdev:1.0.0:dev' where 'libs/' is the folder path you're using?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Uhm, no. If you want to use a Maven classifier for your dependency, you need to add a local repository:

 

repositories {
    flatDir {
        dirs "libs"
    }
}

dependencies {
    compile "ru.ivansteklow.isdev:1.0.0:dev"
}

 

Then Gradle will look for the

isdev-1.0.0-dev.jar

file in your libs folder.

 

Also, using

compile files("isdev-src.jar")

should work, as long as your jar is named isdev-src.jar and not anything else.

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.