The Meaning of Life, the Universe, and Everything.
I recently finished a java book and now I know the basics of java, I want to create a mod but I am having many problems with this new "gradle" thing (After I install it and run eclipse it is full of errors). Do I have to use gradle? If yes please link me to a tutorial on how to install forge with gradle, if no the please link me to the src download.
It's not as if you have to actually write any of the build scripts for gradle. You cannot skip on using gradle, as it is the current system for automatically decompiling and setting up a workspace involving Forge and Minecraft. In order to setup a workspace, go to http://files.minecraftforge.net/ and download the src version for the Minecraft version you wish to modify. Extract the contents of the zip into a directory of your liking. Next, open the command line (Terminal if you're on Mac) and cd to the directory which you unzipped the forge files into. Forge utilizes the gradle wrapper so that you do not have to install gradle if you do not wish. Next, simply run the command
to the command. These are options that modify the gradle logging level, and thus will display more information should gradle have any problems. Remember to include refresh-dependencies always, as certain errors could appear in the eclipse workspace involving missing dependencies if you don't.
Want more background info on what is happening?
Q. What is Gradle?
A. Gradle is a JVM-based build automation software that allows for easier automation of tedious programming tasks such as compiling a project, testing the project, forming a jar for the build, and even Distributing the project in some cases. Gradle has its own DSL (Domain-specific Language) which is essentially built on top of Groovy (a programming language for all intensive purposes in this scenario, built on top of Java). This allows for less verbosity and greater readability than the build scripts of predecessors such as Apache Ant and Apache Maven, both of which utilize an XML system for performing tasks. Gradle attempts to take the middle ground of these two tools providing such features as a dependency management system such that ANT contained and which Maven was only able to attain through Ivy integration, and build conventions such as were present in Maven while also allowing for much more flexibility. In this way, Gradle functions as a much more scaleable build system than these predecessors. This is only the tip of the Iceberg. If you would like to learn more about Gradle, visit the following sites or their provided resources: http://www.gradle.org/overview, http://www.gradle.org/documentation. If you prefer a text to read, a list is provided here. (There is even one in German should any Germans wish to read up on Gradle in their native language.) If you wish to take this route, I personally recommend "Gradle In Action." The publisher even provides a code to attain the eBook versions of the book within the front cover (or at least it did in my copy).
Q. What does the above command do?
A. The gradle command above specifies two tasks (or to be more exact in gradle's case "Atomic pieces of work") to be performed, and a command-line option to be used. These two tasks are setupDecompWorkspace and eclipse. These should be self explanatory as setupDecompWorkspace sets up the Minecraft workspace, along with attaching source documentation which allows you to view the source but not modify it in eclipse. The eclipse command establishes the eclipse files for the project. The refresh-dependencies command-line option simply refreshes the project dependencies.
Q. So I made my mod, but I have no idea what to do now. How do I export it?
A. Simply run the gradle command
while within the workspace directory. Gradle will automatically retrieve the code source within the src/main/java folder and the resources from the src/main/resources folder, compile them, perform basic tests, and then export the jar for your mod to the build/lib folder in your workspace directory.
Q. But wait! I have more questions!
A. Feel free to pm me if you still need help. I will attempt to help you in any way I can.
As stated before at the end of 1.6.4 gradle has become mandatory for forge mods. As for using it, Ghosrec35 is spot on with all the info he has posted.
One thing a lot of people miss or forget to mention, gradle is a very mobile automation software. It can be included as part of your source/project and in fact it is recommended that you package the gradle wrapper with your source. As seen in this github repo I have integrated the wrapper into to project.
^^^ Pretty much says it all right there, but if you want a little more help, Lex did a video on setting everything up:
EDIT: I wonder if the new site will finally let us know when someone posts while replying to a topic...