Changes

20 bytes added ,  21:46, 2 August 2021
Update to 1.17, modify jei references when it updates
Line 18: Line 18:     
== Declaring Dependencies ==
 
== Declaring Dependencies ==
A mod declares a dependency on a mod or library through Gradle, through the <code>dependencies</code> block.<ref>[https://docs.gradle.org/6.8.1/userguide/declaring_dependencies.html Gradle User Guide for 6.8.1: ''Declaring dependencies'']</ref>
+
A mod declares a dependency on a mod or library through Gradle, through the <code>dependencies</code> block.<ref>[https://docs.gradle.org/7.1.1/userguide/declaring_dependencies.html Gradle User Guide: ''Declaring dependencies'']</ref>
    
For example, to declare a dependency on the <code>net:minecraftforge:eventbus:4.0.0</code> library from the <code>main</code> source set:
 
For example, to declare a dependency on the <code>net:minecraftforge:eventbus:4.0.0</code> library from the <code>main</code> source set:
Line 28: Line 28:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
{{Tip|ForgeGradle automatically adds the [https://files.minecraftforge.net/maven/ Forge Maven] and [https://maven.apache.org/repository/ Maven Central] repositories to projects. If a dependency is not present in these (such as dependencies on other mods), the repository containing the dependency must be declared in the <code>repositories</code> block of the Gradle buildscript.<ref>[https://docs.gradle.org/6.8.1/userguide/declaring_repositories.html Gradle User Guide for 6.8.1: ''Declaring repositories'']</ref>}}
+
{{Tip|ForgeGradle automatically adds the [https://files.minecraftforge.net/maven/ Forge Maven] and [https://maven.apache.org/repository/ Maven Central] repositories to projects. If a dependency is not present in these (such as dependencies on other mods), the repository containing the dependency must be declared in the <code>repositories</code> block of the Gradle buildscript.<ref>[https://docs.gradle.org/current/userguide/declaring_repositories.html Gradle User Guide: ''Declaring repositories'']</ref>}}
    
=== Deobfuscating Dependencies ===
 
=== Deobfuscating Dependencies ===
Line 43: Line 43:     
=== Flat Directory Repositories ===
 
=== Flat Directory Repositories ===
There are occasions where it is needed to temporarily add a dependency on a JAR file that is not present in a Maven repository, such as to add a mod which adds some developer tools during runtime. Gradle allows declaring '''flat directory repositories''', which use a local directory as a simplified repository.<ref>[https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver Gradle User Guide for 6.8.1: ''Flat directory repository'']</ref>
+
There are occasions where it is needed to temporarily add a dependency on a JAR file that is not present in a Maven repository, such as to add a mod which adds some developer tools during runtime. Gradle allows declaring '''flat directory repositories''', which use a local directory as a simplified repository.<ref>[https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver Gradle User Guide: ''Flat directory repository'']</ref>
    
A flat directory repository is declared using a <code>flatDir</code> block within the <code>repositories</code> block, and specifying directories using <code>dirs</code>:
 
A flat directory repository is declared using a <code>flatDir</code> block within the <code>repositories</code> block, and specifying directories using <code>dirs</code>:
Line 54: Line 54:  
</syntaxhighlight>
 
</syntaxhighlight>
   −
When a dependency artifact is searched for in a flat directory repository, it will look for the following files in order (<code>''ext''</code> defaults to <code>jar</code>)<ref>[https://github.com/gradle/gradle/blob/v6.8.1/subprojects/core-api/src/main/java/org/gradle/api/artifacts/repositories/FlatDirectoryArtifactRepository.java gradle/gradle; tag v6.8.1; org.gradle.api.artifacts.repositories.FlatDirectoryArtifactRepository]</ref>:
+
When a dependency artifact is searched for in a flat directory repository, it will look for the following files in order (<code>''ext''</code> defaults to <code>jar</code>)<ref>[https://github.com/gradle/gradle/blob/v7.1.1/subprojects/core-api/src/main/java/org/gradle/api/artifacts/repositories/FlatDirectoryArtifactRepository.java gradle/gradle; tag v7.1.1; org.gradle.api.artifacts.repositories.FlatDirectoryArtifactRepository]</ref>:
 
* <code>''<artifact>''-''<version>''.''<ext>''</code>
 
* <code>''<artifact>''-''<version>''.''<ext>''</code>
 
* <code>''<artifact>''-''<version>''-''<classifier>''.''<ext>''</code>
 
* <code>''<artifact>''-''<version>''-''<classifier>''.''<ext>''</code>
Line 60: Line 60:  
* <code>''<artifact>''-''<classifier>''.''<ext>''</code>
 
* <code>''<artifact>''-''<classifier>''.''<ext>''</code>
   −
For example, for the dependency <code>junit:junit:4.8.1</code>, it will first search for <code>junit-4.8.1.jar</code> then <code>junit.jar</code>. The group ID in the dependency descriptor must be present (due to the presence of non-flat directory repositories as added by ForgeGradle), but it will always be ignored.
+
For example, for the dependency <code>org.junit.jupiter:junit-jupiter-api:5.7.2</code>, it will first search for <code>junit-jupiter-api-5.7.2.jar</code> then <code>junit-jupiter-api.jar</code>. The group ID in the dependency descriptor must be present (due to the presence of non-flat directory repositories as added by ForgeGradle), but it will always be ignored.
    
{{Tip/Warning
 
{{Tip/Warning