Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

is already defined #762

Open
ezamelczyk opened this issue Sep 25, 2024 · 1 comment
Open

is already defined #762

ezamelczyk opened this issue Sep 25, 2024 · 1 comment

Comments

@ezamelczyk
Copy link

ezamelczyk commented Sep 25, 2024

I have hundreds of proto files which are defined in a way that they contain the exact same names for classes but each file has a different java_outer_classname but the protoc compiler does not take it into account at all and refuses to compile.

Is there a way to enable this behavior? There's no way for me to change the definition of proto files as I am not the owner.

my build.gradle.kts:

import com.google.protobuf.gradle.*

plugins {
    alias(libs.plugins.kotlin.jvm)
    alias(libs.plugins.google.protobuf)
}

dependencies {
    implementation("com.google.protobuf:protobuf-lite:3.0.0")
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:4.28.2"
    }
    generateProtoTasks {
        all().forEach {
            it.builtins {
                getByName("java") {
                    option("lite")
                }
            }
        }
    }
}

sourceSets {
    main {
        proto {
            srcDir("src/main/resources")
        }
        java {
            srcDir("src/main/java")
        }
    }
}
@ejona86
Copy link
Collaborator

ejona86 commented Sep 25, 2024

This sounds like a question for github.com/protocolbuffers/protobuf/ .

In general, I'd expect not, because the java_outer_classname is java-specific and beside-the-point. If those different messages are all in the same package, then they are clearly conflicting with each other.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants