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

Failing to publish Conjure Java Subprojects #1467

Open
sean-hacker opened this issue Jul 15, 2024 · 0 comments
Open

Failing to publish Conjure Java Subprojects #1467

sean-hacker opened this issue Jul 15, 2024 · 0 comments

Comments

@sean-hacker
Copy link

What happened?

Hey everyone!

I'm attempting to publish JARs from one Conjure Java project to another (trying to publish the Jersey jar as well as the Objects jar) and am struggling to get the configuration right.

My initial configuration looked like the following:

// method-server-api/build.gradle

apply plugin: 'com.palantir.conjure-publish'

configure(subprojects - project('method-server-api-typescript') - project('method-server-api-python')) {
    dependencies {
        compileOnly 'com.palantir.conjure.java:conjure-lib'
        compileOnly 'com.fasterxml.jackson.core:jackson-databind'
    }
}

configure(project('method-server-api-typescript')) {
    def ciServerHost = System.getenv('CI_SERVER_HOST')
    def ciProjectId = System.getenv('CI_PROJECT_ID')
    def ciToken = System.getenv('CI_JOB_TOKEN')

    def registryString = "https://${ciServerHost}/api/v4/projects/${ciProjectId}/packages/npm/"

    generateNpmrc.registryUri = registryString
    generateNpmrc.token = ciToken
}

conjure {
    parser {
        requireSafety = false
    }
    typescript {
        packageName = "@method-security/method-server-api"
    }
    java {
        undertowServicePrefixes = true
        useImmutableBytes = true
        jakartaPackages = true
        useStagedBuilders = true
        nonNullCollections = true
        strictObjects = true
    }
    python {}
}

serviceDependencies {}

This has been working great as I've been publishing Python packages (generating and publishing via some CI steps), but now that I want to publish the Jars, I'm struggling.

I noticed that gradle-conjure doesn't seem to add any Java packages to the publish task within gradle, even though it adds the typescript one. I saw this discussion from 2018 but it's not clear to me why gradle-conjure wouldn't provide a means to add publishing.

I attempted the following (file shortened for brevity)

apply plugin: 'com.palantir.conjure-publish'

configure(subprojects - project('method-server-api-typescript') - project('method-server-api-python')) {
    apply plugin: 'maven-publish'

    publishing {
        publications {
            mavenJava(MavenPublication) {
                from components.java
            }
        }
        repositories {
            maven {
                name = "Gitlab"
                url = <Gitlab Maven URL>
                credentials {
                    username = ...
                    password = ...
                }
                authentication {
                    basic(BasicAuthentication)
                }
            }
        }
    }

    dependencies {
        compileOnly 'com.palantir.conjure.java:conjure-lib'
        compileOnly 'com.fasterxml.jackson.core:jackson-databind'
    }
}

This results in the packages being picked up by publish, but then my compileJava starts failing. From what I can tell, it seems like it's because the Undertow and Jersey projects are failing to take a dependency on the Objects project.

What did you want to happen?

It would be amazing if gradle-conjure exposed a mechanism to allow me to pipe publishing through in a clean manner, so that I can publish my Java packages.

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