intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

Publishing a plugin with the Maven Publish plugin do not take into account `buildSearchableOptions = false`

Open mr-thierry opened this issue 1 year ago • 6 comments

What happened?

I have a plugin that needs to be publish to an internal Maven repo. To publish to this repo I'm using the Maven Publish plugin.

I configure my plugin like so:

intellijPlatform {
    buildSearchableOptions = false
}

This is how the Maven Publish plugin is configured:

publishing {
    publications {
        create<MavenPublication>("plugin") {
            groupId =  "groupId"
            artifactId = "artifactId"
            version = "1.0.0"

            from(components["java"])
        }
    }
}

When I call the task:

./gradlew publishPluginPublicationToMavenLocal

It fails with the following error:

 /…plugin/build/libs/plugin-1.0-SNAPSHOT-searchableOptions.jar (No such file or directory)

I believe the task that generates the JAR files is not properly configured, and as such the Maven Publish plugin cannot find it.

Relevant log output or stack trace

No response

Steps to reproduce

See the description

Gradle IntelliJ Plugin version

2.0.0-beta8

Gradle version

8.8

Operating System

None

Link to build, i.e. failing GitHub Action job

No response

mr-thierry avatar Jul 09 '24 19:07 mr-thierry

The jar task produces just the first version of Jar fine, which is later still enhanced — with instrumented code or merged with other submodules. Currently, components["java"] gives you just the bad Jar file.

What I could do here is introduce a custom intellijPlatform component you could use with components["intellijPlatform"].

The searchable options jar case — this is clearly an issue I have to address.

However, the final plugin Zip archive we publish to JetBrains Marketplace is a bit more than just a jar — or contains also other dependencies, submodules, resources, etc.

What's the exact reason for publishing the plugin to Maven Central?

hsz avatar Jul 11 '24 04:07 hsz

@hsz I am not publishing to Maven Central. I am publishing to an internal Maven repository (artifactory) to deliver my plugin internally.

mr-thierry avatar Jul 12 '24 18:07 mr-thierry

Chiming in here too. My plugin has submodules, which one of them contains shared logic that does not produce any searchable options, so the searchable options task fails for those modules, however disabling the searchable options results in this issue too.

brian-mcnamara avatar Jul 12 '24 18:07 brian-mcnamara

My plugin has submodules

Do you apply there org.jetbrains.intellij.platform.module? This is a limited set of tasks and setups that should be applied to submodules.

hsz avatar Jul 12 '24 19:07 hsz

Do you apply there org.jetbrains.intellij.platform.module? This is a limited set of tasks and setups that should be applied to submodules.

Ahh, I did not know that... Let me play with that

brian-mcnamara avatar Jul 12 '24 19:07 brian-mcnamara

BTW if you want to publish your plugin to maven central (or any other repo that requires javadoc/sources jar), you also need to include them:

publications.register<MavenPublication>("mavenJava") {
  from(components["intellijPlatform"])
  artifact(tasks.named("sourcesJar"))
  artifact(tasks.named("javadocJar"))
}

hfhbd avatar Aug 03 '24 11:08 hfhbd