jreleaser / jreleaser.github.io

🌐 jreleaser.org website
4 stars 39 forks source link

Syntax error in maven deployer guide for JReleaser Gradle #73

Closed ThomasVitale closed 7 months ago

ThomasVitale commented 7 months ago

When using the JReleaser Gradle plugin, the name of the Maven deploy configuration doesn't support dashes. Either avoid dashes or write the name within single quotes.

The following throws an error:

jreleaser {
    deploy {
        maven {
            nexus2 {
                maven-central {
                    active = 'ALWAYS'
                    applyMavenCentralRules = true
                    url = 'https://s01.oss.sonatype.org/service/local'
                    snapshotUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
                    closeRepository = false
                    releaseRepository = false
                    stagingRepository('build/staging-deploy')
                }
            }
        }
    }
}

The error:

A problem occurred evaluating root project 'my-project'.
> No signature of method: org.jreleaser.gradle.plugin.internal.dsl.deploy.maven.MavenImpl.minus() is applicable for argument types: (org.jreleaser.gradle.plugin.internal.dsl.deploy.maven.Nexus2MavenDeployerImpl_Decorated) values: [org.jreleaser.gradle.plugin.internal.dsl.deploy.maven.Nexus2MavenDeployerImpl_Decorated@4b10dfee]
  Possible solutions: find(), find(groovy.lang.Closure), is(java.lang.Object), any(), gitea(groovy.lang.Closure), gitea(org.gradle.api.Action)

The correct version:

jreleaser {
    deploy {
        maven {
            nexus2 {
                'maven-central' {
                    active = 'ALWAYS'
                    applyMavenCentralRules = true
                    url = 'https://s01.oss.sonatype.org/service/local'
                    snapshotUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
                    closeRepository = false
                    releaseRepository = false
                    stagingRepository('build/staging-deploy')
                }
            }
        }
    }
}

PR with the fix: https://github.com/jreleaser/jreleaser.github.io/pull/74