Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struggle with kotlin and multiple publications #105

Closed
glureau opened this issue Apr 24, 2023 · 2 comments
Closed

Struggle with kotlin and multiple publications #105

glureau opened this issue Apr 24, 2023 · 2 comments

Comments

@glureau
Copy link

glureau commented Apr 24, 2023

It may just be an IDE limitation but for some reasons I'm not able to use multiple publications with kotlin scripts.

My buildSrc/build.gradle.kts defines

dependencies {
    [...]
    implementation("org.ajoberstar.grgit:org.ajoberstar.grgit.gradle.plugin:5.2.0")
    implementation("org.ajoberstar.git-publish:org.ajoberstar.git-publish.gradle.plugin:4.2.0")
}

And on top of my module I apply the plugin with:

plugins {
    [...]
    id("org.ajoberstar.git-publish")
    id("org.ajoberstar.grgit")
}

And I feel like my gitPublish configuration should look like:

gitPublish {
    publications.create("step1") {
        repoUri.set("[email protected]:[...]")
        // The other fields for configuration, was working with only 1 publication so I presume there are good...
    }
}

But it gives the error: ^ Unresolved reference: publications

publications have been provided for a short time by IntelliJ autocompletion, but then the dependency from the IDE is pointing to 4.2.0 but I think it have an older version really...
Screenshot 2023-04-24 at 15 56 59
Eventually I've removed my .m2/repository and it looks like the org/ajoberstar is not downloaded again locally for some reasons...

@ajoberstar
Copy link
Owner

I attempted to reproduce this and it seemed to work for me (in IntelliJ Community Edition 2023.1) and Gradle 8.1.1.

Here's my reproduction. It both looks fine in the IDE and when I run ./gradlew tasks --all it lists all of the publication related tasks.

If you find something different with the example that makes it break, can you send a PR over to that repro repo so I can try to see the same on my side?

@glureau
Copy link
Author

glureau commented Apr 25, 2023

I've finally found the root cause of my issue, mkdocs-plugin is leaking the grgit reference and it was just messing with the IDE for some reasons. I was able to avoid this forced dependency with

    implementation("ru.vyarus:gradle-mkdocs-plugin:3.0.0") {
        // Related to https://github.com/xvik/gradle-mkdocs-plugin/issues/23
        exclude(group = "org.ajoberstar.grgit")
        exclude(group = "org.ajoberstar")
    }

I also encountered another issue and found the workaround working.

Eventually I'm able to define (not apply) the plugin on the root, and apply it on 2 different modules, each one declaring its publication, and everything works fine.

Thanks a lot for your time investigating, sorry about that, leaving as much details as possible if it can help the next developer encountering the same problem.

And a big thanks for what you achieved with grgit/git-publish, I used this libs for years on many projects, so useful, sending love for you <3

@glureau glureau closed this as completed Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants