Skip to content

Commit fdc870d

Browse files
committed
Don't fail build on remote details failure
Previously, `gradleutils.pom.addRemoteDetails(pom)` would fail the build if a remote URL was not available. While the error will still be reported, the build will no longer fail. Directly calling `gradleutils.pom.addRemoteDetails(pom, String)` with an invalid URL will still throw an `IllegalArgumentException`.
1 parent 712f91a commit fdc870d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/main/groovy/net/minecraftforge/gradleutils/GradleUtilsProblems.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ void ghWorkflowGitVersionMissing(String taskName) {
3636
//endregion
3737

3838
//region PomUtils
39-
RuntimeException pomUtilsGitVersionMissing(Exception e) {
40-
return this.throwing(e, "pomutils-missing-url", "Cannot add POM remote details without URL", spec -> spec
39+
void reportPomUtilsGitVersionMissing(Exception e) {
40+
report("pomutils-missing-url", "Cannot add POM remote details without URL", spec -> spec
4141
.details("""
4242
Cannot add POM remote details using `gradleutils.pom.addRemoteDetails` without the URL.
4343
If the Git Version plugin has not been applied, the URL must be manually specified as the second parameter.""")
4444
.severity(Severity.ERROR)
45+
.withException(e)
4546
.stackLocation()
4647
.solution("Apply the Git Version Gradle plugin (net.minecraftforge.gitversion) to your project.")
4748
.solution("Manually add the remote URL in `addRemoteDetails`.")

src/main/groovy/net/minecraftforge/gradleutils/PomUtilsImpl.groovy

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ package net.minecraftforge.gradleutils
77
import groovy.transform.CompileDynamic
88
import groovy.transform.CompileStatic
99
import groovy.transform.PackageScope
10-
import net.minecraftforge.gradleutils.shared.SharedUtil
11-
import org.gradle.api.Project
12-
import org.gradle.api.UnknownDomainObjectException
1310
import org.gradle.api.model.ObjectFactory
1411
import org.gradle.api.plugins.ExtensionAware
1512
import org.gradle.api.publish.maven.MavenPom
@@ -53,7 +50,7 @@ import javax.inject.Inject
5350
def url
5451
try {
5552
url = this.target.extensions.getByName('gitversion').url
56-
} catch (UnknownDomainObjectException e) {
53+
} catch (Exception e) {
5754
try {
5855
url = this.target.gradle.extensions.getByName('gitversion').url
5956
} catch (Exception suppressed) {
@@ -63,7 +60,7 @@ import javax.inject.Inject
6360

6461
this.addRemoteDetails(pom, url)
6562
} catch (Exception e) {
66-
throw this.problems.pomUtilsGitVersionMissing(e)
63+
throw this.problems.reportPomUtilsGitVersionMissing(e)
6764
}
6865
}
6966
}

0 commit comments

Comments
 (0)