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

Adding "withSourcesJar" in a Gradle quarkus-cxf build causes duplicate sources to appear in JAR #859

Open
jskillin-idt opened this issue May 2, 2023 · 6 comments

Comments

@jskillin-idt
Copy link

jskillin-idt commented May 2, 2023

Reproducer: https://github.com/jskillin-idt/quarkiverse-quarkus-cxf-issues-859

A project with at least the following lines triggers a build failure, in which the generated source from the WSDL is attempted to be packaged more than once in the source JAR:

plugins {
    // ...
    id 'java'
    id 'io.quarkus' // 3.0.1.Final
}

// ...
dependencies {
    // ...
    implementation 'io.quarkiverse.cxf:quarkus-cxf:2.0.2'
}
// ...
java {
    // ...
    withSourcesJar()
}
// ...

An example failure using the reproducer:

> Task :sourcesJar FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sourcesJar'.
> Entry wsdl2java/org/jboss/eap/quickstarts/wscalculator/calculator/Multiply.java is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/8.1.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

This may be a Quarkus bug, in which case I can pass this along.

@jskillin-idt
Copy link
Author

Reproducer linked.

@shumonsharif
Copy link
Contributor

Hi @jskillin-idt Thanks for the issue and the reproducer!

I'm no Gradle expert, but this appears to me like it is a Gradle issue.

Have you already tried adding the below to your build.gradle file?

tasks.withType(Jar).all { duplicatesStrategy 'exclude' }

If the above is not the ideal / recommended solution, can you provide some details as to why?

@jskillin-idt
Copy link
Author

The above solution isn't ideal because it masks other potential collisions. It'd be preferable to fix the Quarkus plugin code so it only includes the source paths once. The linked issue is a request to have Gradle be more intelligent when a plugin tries to add it multiple times.

@jskillin-idt
Copy link
Author

It'd be preferable to fix the Quarkus plugin code

This is confusing in context of this repo. Sorry. I've filed a lot of Quarkus plugin issues so this got lumped in together in my head. 😆 I generally mean it'd be preferable to fix the root cause of duplicate source paths being added, even if it's the exact same path. I agree with the issue that Gradle could adopt a more intelligent (idempotent?) behavior here, even optionally, but currently that's not how it behaves.

@ppalaga
Copy link
Contributor

ppalaga commented Aug 17, 2023

@jskillin-idt would you please file a new Quarkus issue for this?

@jskillin-idt
Copy link
Author

@jskillin-idt would you please file a new Quarkus issue for this?

Done: quarkusio/quarkus#35854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants