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

SourceSet excludes impacts JAR packaging #39

Closed
jdpgrailsdev opened this issue Apr 8, 2014 · 4 comments
Closed

SourceSet excludes impacts JAR packaging #39

jdpgrailsdev opened this issue Apr 8, 2014 · 4 comments

Comments

@jdpgrailsdev
Copy link

If I add the following to my build.gradle script:

license {
    header rootProject.file('../LICENSE_HEADER.txt')
    strictCheck true
    mapping {
        java='SLASHSTAR_STYLE'
        groovy='SLASHSTAR_STYLE'
    }

    sourceSets {
        main {
            resources {
                exclude '**/*.properties'
            }
        }
    }
}

the plugin correctly skips checking the header on any files in the src/main/resources source folder. However, it appears to also have the side effect of excluding those artifacts from the packaged JAR. My guess is that it is updating the global sourceSets for the build script. This should probably be changed to have a separate excludes configuration property like the corresponding Maven plugin:

<plugin>
    <groupId>com.mycila.maven-license-plugin</groupId>
    <artifactId>maven-license-plugin</artifactId>
    <version>1.9.0</version>
    <configuration>
        <header>${licensePath}</header>
        <excludes>
            <exclude>**/*.properties</exclude>
        </excludes>
        <mapping>
            <java>SLASHSTAR_STYLE</java>
            <groovy>SLASHSTAR_STYLE</groovy>
        </mapping>
        <strictCheck>true</strictCheck>
    </configuration>
</plugin>

Of course, if I could figure out why it fails the check on the license in a properties file, this would be a lesser issue (though still something I believe is worth correcting).

@ericbottard
Copy link

There are definitely valid usecases for defining exclusions that you don't want to impact the rest of the build (for example, on https://github.com/spring-projects/spring-xd we only want licenses on our .java files, but not on the resources/ files. Yet we obviously want them to be seen / included during the build)

@ericbottard
Copy link

Continuing discussion here as it seems to be the most sensible place.
I did try to apply the latest snapshot to our use case (Spring XD).
While I guess I could endup making it work, it feels very cumbersome. What we want is to apply the plugin to *.java files only (i.e. include *.java), as opposed to trying to list all current (and future) excludes

I also understand that replicating the functionality provided by source sets may be a real pain for you :( ..

@hierynomus
Copy link
Owner

@ericbottard If you can open an issue, I'll include includes functionality as well, shouldn't be too hard of a change.

@hierynomus
Copy link
Owner

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

3 participants