build.gradle 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. plugins {
  2. id 'fabric-loom' version '0.10-SNAPSHOT'
  3. id 'maven-publish'
  4. }
  5. sourceCompatibility = JavaVersion.VERSION_17
  6. targetCompatibility = JavaVersion.VERSION_17
  7. archivesBaseName = project.archives_base_name
  8. version = project.mod_version
  9. group = project.maven_group
  10. dependencies {
  11. //to change the versions see the gradle.properties file
  12. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  13. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  14. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  15. // Fabric API. This is technically optional, but you probably want it anyway.
  16. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
  17. // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
  18. // You may need to force-disable transitiveness on them.
  19. }
  20. processResources {
  21. inputs.property "version", project.version
  22. }
  23. // ensure that the encoding is set to UTF-8, no matter what the system default is
  24. // this fixes some edge cases with special characters not displaying correctly
  25. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  26. tasks.withType(JavaCompile) {
  27. options.encoding = "UTF-8"
  28. }
  29. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  30. // if it is present.
  31. // If you remove this task, sources will not be generated.
  32. task sourcesJar(type: Jar, dependsOn: classes) {
  33. classifier = "sources"
  34. from sourceSets.main.allSource
  35. }
  36. jar {
  37. from "LICENSE"
  38. }
  39. // configure the maven publication
  40. publishing {
  41. publications {
  42. mavenJava(MavenPublication) {
  43. // add all the jars that should be included when publishing to maven
  44. artifact(remapJar) {
  45. builtBy remapJar
  46. }
  47. artifact(sourcesJar) {
  48. builtBy remapSourcesJar
  49. }
  50. }
  51. }
  52. // select the repositories you want to publish to
  53. repositories {
  54. // uncomment to publish to the local maven
  55. // mavenLocal()
  56. }
  57. }