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

Entry <xxx> is a duplicate but no duplicate handling strategy has been set #117

Closed
alesproch opened this issue Oct 21, 2021 · 10 comments
Closed
Labels
bug is:fixed This issue is fixed but not yet published

Comments

@alesproch
Copy link

alesproch commented Oct 21, 2021

It's not possible to set duplicatesStrategy for copying of dependencies into lib folder for createExe/launch4j task.
Using gradle 7.x

@TheBoegl
Copy link
Owner

TheBoegl commented Nov 3, 2021

could you please provide a simple working example that you expected to work

@TheBoegl TheBoegl added cannot reproduce We are unable to reproduce this issue with the information provided issuer feedback More information or feedback is needed from the issuer labels Nov 3, 2021
@Shadow-Devil
Copy link
Contributor

Hi, today I faced the same issue.
My minimal build.gradle looks like this:

plugins {
    id 'java'
    id 'edu.sc.seis.launch4j' version '2.4.6'
}

dependencies {
    implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.2'
    implementation 'com.sun.xml.bind:jaxb-xjc:3.0.2'
}

Both dependencies include a common dependency jaxb-core-3.0.2.jar.

The Error that is being displayed is:

Entry jaxb-core-3.0.2.jar is a duplicate but no duplicate handling strategy has been set. 
Please refer to https://docs.gradle.org/7.1.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

But when I try to add a duplication handling strategy it doesn't work:

plugins {
    id 'java'
    id 'edu.sc.seis.launch4j' version '2.4.6'
}

dependencies {
    implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.2'
    implementation 'com.sun.xml.bind:jaxb-xjc:3.0.2'
}

launch4j {
    duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

This works inside the jar task.

@Shadow-Devil
Copy link
Contributor

If you could help me with some guidance where the error could be solved, I would like to work on this issue 😄

@TheBoegl
Copy link
Owner

This seems to be related to the used copy tasks. You should be able to create a PR adding the strategy there and testing it with the reproducible code snippet you provided.

@Shadow-Devil
Copy link
Contributor

So I've created a test with my code snippet and it worked.
It's because this repo is using Gradle 6.x and I was using Gradle 7.x.
See also here: https://docs.gradle.org/current/userguide/upgrading_version_6.html#duplicates-strategy

@Shadow-Devil
Copy link
Contributor

Is it currently possible to let a test run with a different Gradle version than specified at the root project?

@Shadow-Devil
Copy link
Contributor

I thought, that maybe something like this would work:

launch4j{
    mainClassName = 'com.test.app.Main'
    copyConfigurable = copySpec {
        duplicatesStrategy = DuplicatesStrategy.INCLUDE
    }
}

But now I'm getting the error message:

Cannot fingerprint input property 'copyConfigurable': value 'org.gradle.api.internal.file.copy.DefaultCopySpec_Decorated@5fd1326f' cannot be serialized.

I was looking through the code and found the copyConfigurable, that to my understanding should also be settable to a CopySpec.

@TheBoegl
Copy link
Owner

There are already some tests in this repo that run against different gradle versions.

I don't have access to my IDE now but you might be able to set the strategy on the distSpec variable.

@Shadow-Devil
Copy link
Contributor

Shadow-Devil commented Oct 22, 2022

I've created a draft PR (#123) that fixes the issue. It just hardcodes it to exclude any duplicate entries. Maybe we should introduce a new property so the user can specify what DuplicatesStrategy should be used.

@TheBoegl TheBoegl added bug and removed cannot reproduce We are unable to reproduce this issue with the information provided labels Oct 25, 2022
TheBoegl added a commit that referenced this issue Oct 30, 2022
Issue #117 Entry <xxx> is a duplicate but no duplicate handling strategy has been set
@Shadow-Devil
Copy link
Contributor

I think this issue can be closed, since the PR was already merged

@TheBoegl TheBoegl added is:fixed This issue is fixed but not yet published and removed issuer feedback More information or feedback is needed from the issuer labels Nov 2, 2022
@TheBoegl TheBoegl closed this as completed Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug is:fixed This issue is fixed but not yet published
Projects
None yet
Development

No branches or pull requests

3 participants