1

Is it possible to tell the gmaven plugin to "skip" the compilation of a single groovy file inside of a directory that has already been given as a source?

For some background, I'm using gmaven + junit to unit test some Jenkins pipeline libraries. For the purposes here, these libraries just exist as groovy scripts under a folder called vars/. I have dozens of these *.groovy files under vars/, but one of them will not compile because it is importing a package that appears to be proprietary. I don't have access to that package locally, outside of the context of the Jenkins server, which defeats my intention of running unit tests locally. I'd like to just skip that one file.

My pom looks like this:

<plugin>
    <groupId>org.codehaus.gmavenplus</groupId>
    <artifactId>gmavenplus-plugin</artifactId>
    <version>1.5</version>
    <executions>
        <execution>
            <goals>
                <goal>addSources</goal>
                ...
            </goals>
        </execution>
    </executions>
    <configuration>
        <sources>
            <source>
                <directory>${project.basedir}/vars</directory>
                <includes>
                    <include>**/*.groovy</include>
                </includes>
            </source>
            ...
    </configuration>
</plugin>

Effectively, I'd like to do something like this:

<source>
    <directory>${project.basedir}/vars</directory>
    <includes>
        <include>**/*.groovy</include>
    </includes>
    <excludes>
        <exclude>**/FileToExclude.groovy</exclude>
    </excludes>
</source>

Is that possible?

blindsnowmobile
  • 3,868
  • 6
  • 32
  • 47
  • Did you solve this? I have same problem at the moment – sarah Aug 14 '18 at 12:41
  • What you have is the correct configuration. Just make sure you use that configuration for all executions that include goals that need to know about the sources (addSources, generateStubs, compile, groovydoc -- or the test versions if the code is tests). GMavenPlus is using the Maven built-in [FileSet](https://maven.apache.org/shared/file-management/fileset.html), no special logic. – Keegan Oct 18 '18 at 00:31

0 Answers0