您尚未登录。

#1 2025-03-22 16:56:08

Lotput
会员
注册时间: 2025-01-01
帖子: 20

gradle构建问题

我最近在学mc模组开发,准备构建mod,结果失败,但是我放在windows上就没有问题
它一直提示

A problem occurred configuring root project 'slave-template-1.20.1'.
> Failed to setup Minecraft, org.gradle.api.InvalidUserDataException: You must specify a URL for a Maven repository.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.12.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

喂给deepseek,他说没有配置仓库
但是检查了配置文件,没啥问题
build.gradle

plugins {
	id 'fabric-loom' version '1.10-SNAPSHOT'
	id 'maven-publish'
}

version = project.mod_version
group = project.maven_group

base {
	archivesName = project.archives_base_name
}

repositories {
	mavenCentral()
	maven { url "https://maven.fabricmc.net/" }
	maven { url "https://server.bbkr.space/artifactory/libs-release" }
}

fabricApi {
	configureDataGeneration {
		client = true
	}
}

dependencies {
	// To change the versions see the gradle.properties file
	minecraft "net.minecraft:minecraft:${project.minecraft_version}"
	mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
	modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

	// Fabric API. This is technically optional, but you probably want it anyway.
	modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
	
}

processResources {
	inputs.property "version", project.version

	filesMatching("fabric.mod.json") {
		expand "version": inputs.properties.version
	}
}

tasks.withType(JavaCompile).configureEach {
	it.options.release = 17
}

java {
	// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
	// if it is present.
	// If you remove this line, sources will not be generated.
	withSourcesJar()

	sourceCompatibility = JavaVersion.VERSION_17
	targetCompatibility = JavaVersion.VERSION_17
}

jar {
	inputs.property "archivesName", project.base.archivesName

	from("LICENSE") {
		rename { "${it}_${inputs.properties.archivesName}"}
	}
}

// configure the maven publication
publishing {
	publications {
		create("mavenJava", MavenPublication) {
			artifactId = project.archives_base_name
			from components.java
		}
	}

	// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.

}

这到底出了什么问题


一个初中生,可能无法及时回帖(学业需要)

离线

#2 2025-03-22 18:35:49

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 9,168
个人网站

Re: gradle构建问题

版本的问题?

离线

页脚