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

Question: Publish feature #864

Open
mingchiuli opened this issue Oct 30, 2024 · 0 comments
Open

Question: Publish feature #864

mingchiuli opened this issue Oct 30, 2024 · 0 comments

Comments

@mingchiuli
Copy link

mingchiuli commented Oct 30, 2024

The Document of gradle publish describe that Depending on the metadata file format, publishing features may be loss if some config were lost. I found the generated maven xml label of optional would be lost if i publish package via ./gradlew publishAndReleaseToMavenCentral.

Expectation:

    <dependency>
      <groupId>org.springframework.amqp</groupId>
      <artifactId>spring-rabbit</artifactId>
      <scope>runtime</scope>
      <optional>true</optional>
    </dependency>

Fact:

    <dependency>
      <groupId>org.springframework.amqp</groupId>
      <artifactId>spring-rabbit</artifactId>
      <scope>runtime</scope>
    </dependency>

My gradle setting is:

import com.vanniktech.maven.publish.SonatypeHost

version = "1.0.1"

plugins {
    id("com.vanniktech.maven.publish") version "0.30.0"
}

mavenPublishing {
    publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
    signAllPublications()

    coordinates("$group", "cache-spring-boot-starter", "$version")

    pom {
        name.set("Megalith Cache")
        description.set("A Cache Framework for Megalith")
        inceptionYear.set("2024")
        url.set("https://github.com/mingchiuli/megalith-micro/")
        licenses {
            license {
                name.set("The Apache License, Version 2.0")
                url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
                distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
            }
        }
        developers {
            developer {
                id.set("chiu")
                name.set("mingchiuli")
                url.set("https://github.com/mingchiuli/")
            }
        }
        scm {
            url.set("https://github.com/mingchiuli/megalith-micro/")
            connection.set("scm:git:git://github.com/mingchiuli/megalith-micro.git")
            developerConnection.set("scm:git:ssh://[email protected]/mingchiuli/megalith-micro.git")
        }
    }
}

sourceSets {
    create("rabbitmqSupport") {
        java {
            srcDirs("/src/rabbitmq/java")
            resources.srcDir("/src/rabbitmq/resources")
        }
    }
}

java {
    registerFeature("rabbitmqSupport") {
        usingSourceSet(sourceSets["rabbitmqSupport"])
        capability("$group", "cache-rabbit-support", "$version")
    }
}

dependencies {
    implementation("org.redisson:redisson:${ext.get("redisson.version")}")
    implementation("com.github.ben-manes.caffeine:caffeine")
    implementation("org.aspectj:aspectjweaver")
    sourceSets.named("rabbitmqSupport") {
        implementation("org.springframework.amqp:spring-rabbit")
    }
    compileOnly("jakarta.servlet:jakarta.servlet-api")
    compileOnly("org.springframework:spring-context")
    compileOnly("org.springframework:spring-core")
    compileOnly("org.springframework:spring-web")
    compileOnly("org.springframework.boot:spring-boot-autoconfigure")
}

Is there some methods here to add the label of optional?

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

1 participant