yananhub / flying-gradle-plugin

A plugin that allows you to publish repositories to the Maven Central Portal (new publish process)
Apache License 2.0
7 stars 1 forks source link

Plugin improvements #4

Open lipiridi opened 1 month ago

lipiridi commented 1 month ago

Hi! I like the idea of your plugin, and want to propose some improvements:

  1. Get rig of the necessity to specify the local repository. Maybe exists a way to register it automatically or use the default maven local? repositories { maven { name = "Local" url = layout.buildDirectory.dir("repos/bundles").get().asFile.toURI() } }
  2. Tie up tasks publish and publishToMavenCentralPortal because the second one doesn't include the first one. So I have to run both tasks to release successfully.
  3. Make publishing type enum for convenience, to see all options immediately publishingType.set(PublishingType.USER_MANAGED).
  4. Replace authToken with params username and password. Build an encoded token on your own.
  5. Give the ability to specify username and password as env variables. Smth like "MAVEN_CENTRAL_USERNAME". Also accept them from gradle.properties

After all these improvements, the task will look like this by default: mavenCentral {}

yananhub commented 3 weeks ago

Hi @lipiridi,

  1. It's a good idea, and I'm thinking about how to implement it.
  2. At first I thought about this point, considering that some people might also need to use traditional OSSRH like repositories. For example, some people want to publish it to both Maven Central and GitHub Packages, which require both ways.
  3. Using enum may force users to add additional imported classes. This has been discussed in the previous PR https://github.com/yananhub/flying-gradle-plugin/pull/2#discussion_r1666520307
  4. The Maven Central official API requires passing in this format, and I prefer to keep it the same as the official one.
  5. You can actually use authToken = System.getenv('MAVEN_UPLOAD_TOKEN') or authToken = project.mavenUploadToken to achieve the same effect. Please refer to https://github.com/yananhub/flying-mybatis/blob/main/build.gradle