How do I fix a Gradle compiling error related to "aritfact from gradle"?
**My Probelm:**
Whenever I try to build or sync with gradle, I get an error related to my build.gradle which connects to an artifacts.gradle from github. It appears that it cannot get a class from a github for the artifacts.gradle.
What I think is that the github is missing a class, or it cannot be pulled from at all, but this error is the only one preventing me from compiling my mod, which I want to do.
**Specs of the project:**
I am making a minecraft mod for 1.19.2 using java 17 and gradle 7.2
here is the error I get:
(this is the whole error saying that on line 6 with the artifacts.gradle from a github, it is missing a class)
```
FAILURE: Build failed with an exception.
* Where:
Script 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/master/minecraft/artifacts.gradle' line: 6
* What went wrong:
A problem occurred evaluating script.
> Could not get unknown property 'classes' for root project 'Prestige-master' of type org.gradle.api.Project.
```
**And here is my build.gradle:**
```gradle
buildscript {
repositories {
jcenter()
maven {
url = uri('https://files.minecraftforge.net/maven')
}
maven {
url = uri('https://plugins.gradle.org/m2/')
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:4.1.0'
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.1.0'
}
}
repositories {
jcenter()
maven {
url = uri('https://files.minecraftforge.net/maven')
}
maven {
url = uri('https://plugins.gradle.org/m2/')
}
maven {
url = uri('https://maven.mcmoddev.com')
}
maven {
url = uri('https://maven.blamejared.com')
}
}
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/master/generic/secrets.gradle'
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/master/generic/markdown-git-changelog.gradle'
<mark>apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/master/minecraft/artifacts.gradle'</mark>
apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/master/minecraft/maven.gradle'
loadSecrets()
version = "${mod_version}" + getBuildNumber()
group = "${mod_group}"
archivesBaseName = "${mod_name}-${version_minecraft}"
sourceCompatibility = 17
targetCompatibility = 17
minecraft {
version = "${version_minecraft}-${version_forge}"
mappings = "${version_mcp}"
runDir = 'run'
replace '@VERSION@', project.version
replace '@FINGERPRINT@', project.findProperty('signSHA1')
replaceIn "${mod_class}.java"
dependencies {
implementation "net.darkhax.bookshelf:Bookshelf:1.19.2-16.3.20"
implementation "com.blamejared.crafttweaker:CraftTweaker:1.19.2-10.1.47"
}
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
from 'LICENSE'
}
String getBuildNumber() {
return System.getenv('BUILD_NUMBER') ?: System.getenv('TRAVIS_BUILD_NUMBER') ?: '0'
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
curseforge {
apiKey = findProperty('curse_auth') ?: 0
def versions = "${curse_versions}".split(', ')
project {
id = "${curse_project}"
releaseType = 'alpha'
changelog = getGitChangelog
changelogType = 'markdown'
versions.each {
addGameVersion "${it}"
}
if (project.hasProperty('curse_requirements') || project.hasProperty('curse_optionals')) {
mainArtifact(jar) {
relations {
if (project.hasProperty('curse_requirements')) {
def requirements = "${curse_requirements}".split(', ')
requirements.each {
requiredLibrary "${it}"
}
}
if (project.hasProperty('curse_optionals')) {
def optionals = "${curse_optionals}".split(', ')
optionals.each {
optionalLibrary "${it}"
}
}
}
}
}
addArtifact(sourcesJar)
addArtifact(javadocJar)
addArtifact(deobfJar)
}
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf {
project.hasProperty('keyStore')
}
keyStore = project.findProperty('keyStore')
alias = project.findProperty('keyStoreAlias')
storePass = project.findProperty('keayStorePass')
keyPass = project.findProperty('keyStoreKeyPass')
inputFile = jar.archivePath
outputFile = jar.archivePath
}
build.dependsOn signJar
```
(https://i.stack.imgur.com/2EvpL.png
https://i.stack.imgur.com/PBVNo.png
I have tried to reinstall gradle, install the artifacts.gradle as a file, and use other online resources but none of them have worked for me. I was expecting gradle to build my mod into a jar, but instead I get an error.
If someone can help fix my build.gradle, or make it compatible for the newer version of gradle, I would really appreciate it.
Please sign in to leave a comment.
Hello,
Am I got it right that build from command line doesn't work as well?