Skip to content

Using same directories for java and resources yields duplicate files in source jar #69

@andreas-schilling

Description

@andreas-schilling

I'm using the sourceJar task to build a -sources bundle for a project.
It's an OSGi bundle and due to the project layout, the source set is defined as follows:

sourceSets {
    main {
        java {
            srcDirs = ['src']
        }
        resources {
            srcDirs = ['src']
        }
    }
}

This is quite common actually. Using the sourceJar task then yields all files to be duplicated inside the resulting jar.
This can easily be fixed by doing this:

sourceJar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

I'm just wondering whether it would make sense to include this option in the task definition already?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions