0

I have a gradle project that I need to do some automated releasing in and I am supposed to use the nebula-release-plugin. I have not tried to release with gradle before, so I am following this approach. When I try to add the nebula plugin, I get a Task with name 'release' not found in root project 'my-project-name'. The documentation does not say anything about specifying a release task, so I don't know how to make one. I get that I need to specify a way to deploy the app, but it has been hard to find a way that works and is compatible with nebula.

My build.gradle:

plugins {
    id 'org.springframework.boot' version '2.5.2'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id 'com.github.bjornvester.wsdl2java' version '1.1'
    id 'com.github.johnrengelman.shadow' version '7.0.0'
    id 'maven-publish'
    id 'nebula.release' version '13.2.1' // https://github.com/nebula-plugins/nebula-release-plugin
}

group = 'dk.dxc'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
}

task unpack(type: Copy) {
    dependsOn bootJar
    from(zipTree(tasks.bootJar.outputs.files.singleFile))
    into('build/dependency')
}

test {
    useJUnitPlatform()
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId = Project.getName()
            from components.java
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
            pom {
                name = 'soap-demo-gradle'
                description = 'A template for soap services using gradle'
                scm {
                    connection = 'scm:git:url/to/my/git/repo'
                    developerConnection = 'scm:git:url/to/my/git/repo'
                    url = 'scm:git:url/to/my/git/repo'
                }
            }
        }
    }
    repositories {
        maven {
            def releasesRepoUrl = "url/to/my/nexus/repo"
            def snapshotsRepoUrl = "url/to/my/nexus/repo"
            url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
        }
    }
}
Kikkomann
  • 386
  • 5
  • 20
  • `./gradlew final`? – chehsunliu Aug 03 '21 at 17:48
  • @chehsunliu Well, I haven't looked at the problem since I asked the question (I gave up). Before the build.gradle wouldn't even compile - it said that it was missing the release task - but now there are no errors. Now I have to solve the publishing, but for some unknown reason my initial problem seems to have been solved. I will update the question when I figure out more. – Kikkomann Aug 04 '21 at 09:56

1 Answers1

0

There's no need to specify a release task because it comes within the nebula-release plugin. This error may occur if the plugin couldn't start properly for some reason and the tasks provided by it aren't available. So if you try to run some task that depends on the release task the build will fail.

In my case, the problem was that I hadn't started a git repository on my project.

Git repository not found at <project-path> -- nebula-release tasks will not be available. Use the git.root Gradle property to specify a different directory.

After initiating a git repository with git init the tasks of the plugin became available.

Kaue
  • 36
  • 3