Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Gradle Dependency Solutions for Public Projects without Maven Artifacts


perry
 Share

Recommended Posts

I'm interested to know what solutions people have come up with for Gradle dependencies on public projects that do not publish maven artifacts.

 

A simple solution is to download the deobfuscated JAR or build it locally then drop it in the libs folder. Not only does this involve a fiddly manual task but it can cause problems with automated builds. For my Jenkins server to successfully build I would need to include the JAR in my git repo which I don't want to do for copyright reasons nor do I want to constantly be pushing a binary blob up to my server.

 

My current solution is to add a git clone task the buildscript that fetches a github repo. Though I haven't yet figured out how to set up the dependencies so that clone is executed automatically.

 

build.gradle

buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
        classpath 'org.ajoberstar:gradle-git:0.6.3'
    }
}

...

clone.dependsOn {
    tasks.findAll { task -> !task.name.equals("clone") && task.name.startsWith('clone') }
}

task cloneMod(type: GitClone) {
    def destination = file("../mod")
    uri = "https://github.com/user/mod.git"
    branch = "1.9.4"
    destinationPath = destination
    bare = false
    enabled = !destination.exists()
}

 

Then in settings.gradle I include the project and add it as a dependency in build.gradle:

 

settings.gradle

include ':mod'
project(':mod').projectDir = new File(settingsDir, '../mod')

 

build.gradle

dependencies {
    compile project(':mod')
}

 

With this set up I can get a successful build with gradlew clone && gradlew build.

 

This solution should also involve a pull to get the latest updates for the given branch but I haven't gotten that far yet as I'm not sure if I'm going to keep handle dependencies like this.

 

This approach has several drawbacks however. For one builds are much slower as Gradle has to spool up and run through all the tasks on the dependent mod, even if the tasks are up to date it still takes a while before we get to building our own mod.

 

Additionally it seems that tasks like gradlew runClient will run for both projects. This means that after closing the one instance on MineCraft another one will start up. It's quite annoying but can be avoided if you halt the gradle task before closing the first instance. I'm sure there's a way to avoid this in the build script but I currently haven't figured that out yet.

 

Another option could be to use my Jenkins server to compile dependent mods. I could then either figure out a Jenkins script to publish artifacts to my own maven repo which my mods build.gradle can use as a dependency. Though this would probably also cause some copyright issues as I would be publicly distributing other peoples mods.

 

The other option for this approach could be to push the scripting to mod's build.gradle where a script could check if we have the latest Jenkins build. If we don't have the latest build it would remove the old one and pull down the latest deobfuscated JAR to the libs folder. I believe it this would be fine so long as downloading artifacts requires authentication on the Jenkins server.

 

A third option that I am warming to would be a variant on my current solution but without depending on a sub project. Instead the script would check if we have the mod JAR in libs, if not it would clone, build, and copy the deobfuscated JAR into the libs folder. I'm sure there would be opportunity to code in version numbers / commit IDs to have more control over which version of the mod we need to depend on.

 

Fourth option.. I could ask the mod author to publish artifacts.

 

Thoughts? Anyone else have any solutions?

 

[move]Perry[/move]

 

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Whoops! Sorry about that. I've updated the code and removed the reference. The errant line (DivineFavourTabGui.java:31) is currently commented out as well.
    • Take a look at the github https://github.com/lordofwizard/mcserver and the video in it if you want to try it out You can host your very own Java/Bedrock Minecraft Server using Google Cloud Shell. This works under Ubuntu/Debian based Linux operation system. This project requires NO CREDIT CARD and the whole project is entirely FREE! You can make a server without costing you anything. The following features are added into this project are:   Supports different type of Bedrock Servers Clean & Friendly Interface Supports Additional type of Java Server (eg. Sponge, Paper, Fabric etc) Added Server Management Easier functional scripts (eg. ./uninstall allows you to delete your server easily) Instant EULA script setup (Completly skipping this part which makes other people's life much easier to manage) Faster Server Installation (It would probably take you like approx 30 seconds to setup a server) Server Specs: OS: Debian GNU/Linux 10 (buster) x86_64 RAM: 8GB to 16GB Location: Based on your physical location. Storage: Approx 5GB CPU: AMD EPYC (2) 7B12 @ 2.249GHz or Intel Xeon (4) @ 2.199GHz You can view your exact specs by doing ./specinfo Keeping the Server Alive 24/7 There's only ONE way to keep your server online longer than 20 minutes: You must Keep your browser open to keep your server online. This so the shell doesn't get terminated when it's unused or the browser is closed. You can also use google cloud sdk if you don't want to keep you browser open (Don't worry, your device that is being used to host your server isn't affected from the intensity of your server.) If you have any method the would possibly keep the server alive 24/7, feel free to Fork this project and request a Pull to this project. Any help will be greatly appreciated. Limitation of this project Google Cloud Shell Quota While I was editing this project, I notice that Google has added a quota for each Cloud Shell uses and you can only host your server for the max of 50 hours per Week. Once you used all of the hours, you can't use it again until next week. No Dedicated IP Sadly you can't use the host IP into your dedicated IP as it won't let you join that server, you can only join your server by the generated dedicated IP provided by playit.gg. If you know how to reverse proxy the tunnel system, you can actually use the host IP to make a dedicated IP for your server but I highly doubt that would ever happen. Mixed Server Specs Each Cloud Shell session will have different specs of your server based on your physical location so you won't always get the best performance of your server but good news being that it's always the range between 8GB to 16GB so you won't have to worry about lag when playing in the server with high processing in your server. Even take a look at this:https://cloud.google.com/shell/docs/limitations Conclusion Now you can host your very own Minecraft Server for both Java & Bedrock fast and easy and it won't cost you a single penny to make a fast and strong server. Best of all, IT'S FOREVER! Feel free to leave any requests you would like me to add into the project. If you have any issues, go to the Issues tab and submit a issue there.
    • Take a look at the github https://github.com/lordofwizard/mcserver and the video in it if you want to try it out You can host your very own Java/Bedrock Minecraft Server using Google Cloud Shell. This works under Ubuntu/Debian based Linux operation system. This project requires NO CREDIT CARD and the whole project is entirely FREE! You can make a server without costing you anything. The following features are added into this project are:   Supports different type of Bedrock Servers Clean & Friendly Interface Supports Additional type of Java Server (eg. Sponge, Paper, Fabric etc) Added Server Management Easier functional scripts (eg. ./uninstall allows you to delete your server easily) Instant EULA script setup (Completly skipping this part which makes other people's life much easier to manage) Faster Server Installation (It would probably take you like approx 30 seconds to setup a server) Server Specs: OS: Debian GNU/Linux 10 (buster) x86_64 RAM: 8GB to 16GB Location: Based on your physical location. Storage: Approx 5GB CPU: AMD EPYC (2) 7B12 @ 2.249GHz or Intel Xeon (4) @ 2.199GHz You can view your exact specs by doing ./specinfo Keeping the Server Alive 24/7 There's only ONE way to keep your server online longer than 20 minutes: You must Keep your browser open to keep your server online. This so the shell doesn't get terminated when it's unused or the browser is closed. You can also use google cloud sdk if you don't want to keep you browser open (Don't worry, your device that is being used to host your server isn't affected from the intensity of your server.) If you have any method the would possibly keep the server alive 24/7, feel free to Fork this project and request a Pull to this project. Any help will be greatly appreciated. Limitation of this project Google Cloud Shell Quota While I was editing this project, I notice that Google has added a quota for each Cloud Shell uses and you can only host your server for the max of 50 hours per Week. Once you used all of the hours, you can't use it again until next week. No Dedicated IP Sadly you can't use the host IP into your dedicated IP as it won't let you join that server, you can only join your server by the generated dedicated IP provided by playit.gg. If you know how to reverse proxy the tunnel system, you can actually use the host IP to make a dedicated IP for your server but I highly doubt that would ever happen. Mixed Server Specs Each Cloud Shell session will have different specs of your server based on your physical location so you won't always get the best performance of your server but good news being that it's always the range between 8GB to 16GB so you won't have to worry about lag when playing in the server with high processing in your server. Even take a look at this:https://cloud.google.com/shell/docs/limitations Conclusion Now you can host your very own Minecraft Server for both Java & Bedrock fast and easy and it won't cost you a single penny to make a fast and strong server. Best of all, IT'S FOREVER! Feel free to leave any requests you would like me to add into the project. If you have any issues, go to the Issues tab and submit a issue there.
    • Hey guys, I'm trying to run the dev env with two mods (Alexs Mobs and Citadel), therefore I copied their build.gradle because there's a lot of mixin stuff: build.gradle: https://pastebin.com/PUef70eP The server boots up normally when I use the old mappings, but when I change to Mojang's mappings, I get this error on startup: java.lang.BootstrapMethodError: java.lang.ClassFormatError: Duplicate method name "isFood" with signature "(Lnet.minecraft.item.ItemStack;)Z" in class file com/github/alexthe666/alexsmobs/entity/EntityRaccoon I already use fg.deof to match the mappings of the mods to my mappings, what else could be the reason for this error?  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.