0

I want to upgrade an old plugin that is written in grails 2. But am having difficulties in setting up a new grails 5 plugin and it's build.gradle file. Seemingly nowhere it's documented how to publish a plugin to your own repository.

I created an empty grails 5.2.4 plugin project with this command

grails create-plugin newPluginProject --profile=plugin

this is the following build.gradle file that I have tried (part of it anyways)

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin: "org.grails.grails-plugin"
apply plugin: 'maven-publish'
apply plugin: "io.github.gradle-nexus.publish-plugin"

repositories {
    maven {
        url "http://company-nexus.com:8081/nexus/repository/maven-public/"
        allowInsecureProtocol = true
        credentials {
            username "my-name"
            password "my-password"
        }
    }
    maven {
        name "internal-releases"
        url "http://company-nexus.com:8081/nexus/repository/maven-releases/"
        allowInsecureProtocol = true
        credentials {
            username "my-name"
            password "my-password"
        }
    }
    maven {
        name "internal-snapshots"
        url "http://company-nexus.com:8081/nexus/repository/maven-snapshots/"
        allowInsecureProtocol = true
        credentials {
            username "my-name"
            password "my-password"
        }
    }
    maven { url "https://repo.grails.org/grails/core" }
}

publishing {
    repositories {
        maven {
            url = "http://company-nexus:8081/nexus/repository/maven-releases/"
            username = 'my-name'
            password = 'my-password'
        }
    }
}

I did try to follow this guide and modify it for our use, but it seems that no combination of settings is working.

I looked at the documentation found at gradle nexus publish plugin. But it seems that grails completely ignores those settings

Grails seemingly doesn't support publishing plugins to your internal repository? Because the commands in grails documentation and even from documents found online don't work

What am I doing wrong?

I even tried this example from gradle nexus plugin and it is not even trying to connect to our repositories.

plugins {
    id "java-library"
    id "maven-publish"
    id "io.github.gradle-nexus.publish-plugin" version "«version»"
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from(components.java)
        }
    }
}

nexusPublishing {
    repositories {
        myNexus {
            nexusUrl = uri("https://your-server.com/staging")
            snapshotRepositoryUrl = uri("https://your-server.com/snapshots")
            username = "your-username" // defaults to project.properties["myNexusUsername"]
            password = "your-password" // defaults to project.properties["myNexusPassword"]
        }
    }
}
Gabriel
  • 1,820
  • 2
  • 23
  • 31
  • "Seemingly nowhere it's documented how to publish a plugin to your own repository." - https://docs.gradle.org/current/userguide/publishing_maven.html may be helpful. – Jeff Scott Brown Dec 12 '22 at 14:46

0 Answers0