gradle / gradle

Adaptable, fast automation for all
https://gradle.org
Apache License 2.0
16.85k stars 4.71k forks source link

java-library and java-platform: create default publication when maven-publish is applied #18120

Open gabrielittner opened 3 years ago

gabrielittner commented 3 years ago

Expected Behavior

Having

plugins {
  id "java-library"
  id "maven-publish"
}

or

plugins {
  id "java-platform"
  id "maven-publish"
}

should automatically create a publication without requiring further configuration by the user.

Current Behavior

Currently you need to add

publishing {
    publications {
        create<MavenPublication>("myLibrary") {
            from(components["java"])
        }
    }
}

and

publishing {
    publications {
        create<MavenPublication>("myPlatform") {
            from(components["javaPlatform"])
        }
    }
}

respectively to the above configuration to enable publishing.

Context

Creating publications by default would match both the current behavior of the java-gradle-plugin and the general convention over configuration approach. The user already indicated that they want to publish the library/platform so they shouldn't need to repeat that same piece of code everytime.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our blog post on how we refine our backlog. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

gabrielittner commented 2 years ago

Still relevant