Open Goooler opened 8 months ago
Beautiful report!
Based on what you have in OP, I think this is WAI because we have 3 publications in the logs:
> Task :publishMavenJavaPublicationToMavenLocal
> Task :publishOsgiPluginPluginMarkerMavenPublicationToMavenLocal
> Task :publishPluginMavenPublicationToMavenLocal
and 3 artifacts in the folder.
mavenJava
as legacy...
, pluginMaven
publication which uses the gradle...
project name.Try to change to
named<MavenPublication>("pluginMaven").configure { ... }
~(You might need afterEvaluate or matching to get the timing right. source)~ The timing issue seems fixed, so I need to review my workaround.
Btw, I think this issue is with id("com.gradle.plugin-publish")
because this nexus plugin only sets up the sonatype tasks not the maveLocal ones. That said it would be the same issue just with harder visibility on folder contents.
Seems can't:
Publication with name 'pluginMaven' not found.
publishing.publications
is empty.
even in afterEvaluate
?
publishing {
publications {
afterEvaluate {
named<MavenPublication>("pluginMaven") {
...
}
}
}
}
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'gradle-legacy-osgi-plugin'.
> Maven publication 'pluginMaven' cannot include multiple components
That's so weird, looking.
Ah, the error is not that it's not found, but it by default includes the Java component, see org.gradle.plugin.devel.plugins.MavenPluginPublishPlugin
.
Here's what I would go with: use all the built-ins and no workarounds needed: publishing.patch (delete all the commented lines when applying, they're just for you, keep // Pre-configure ...
)
Docs:
Thanks a lot! It works for me now.
Should we note this in README or fallback it?
I'm not sure what we could add, @szpak thoughts?
Note: this plugin is a generic publishing plugin, publishing Gradle plugins still uses all the same facilities, except Gradle provided plugin does most of the wiring that's still required for normal library jars.
I think this might need a full rewrite of the readme, giving examples for the most common use cases, so it's easier for people to copy-paste when they don't know/want to know the details?
I would agree with Rob, that it's rather a problem with the generic publishing configuration in Gradle.
Do you have a good idea/proposal how the new README could look like? We could also fold some sections to make it easier to read (and to find the basic cases).
My config like this:
artifactId
has been declared explicitly, and the default project name isgradle-legacy-osgi-plugin
, then publish it to MavenLocal:We just expect
io.github.goooler.osgi.gradle.plugin
andlegacy-osgi-gradle-plugin
here, butgradle-legacy-osgi-plugin
has been published as well, which with the default project name.Full config here https://github.com/Goooler/gradle-legacy-osgi-plugin/commit/b941a218a7a89beb207dec0033d7aec22872a017.