groovy / GMavenPlus

A rewrite of GMaven, a Maven plugin for Groovy
Other
285 stars 35 forks source link

Null Pointer Exception trying to build a joint project #195

Closed jeacott1 closed 2 years ago

jeacott1 commented 3 years ago

Null Pointer Exception trying to build a joint project groovy 2.4.8 gmavenplus-plugin 1.12.1

    <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>1.12.1</version>
        <executions>
          <execution>
            <goals>
              <goal>addSources</goal>
              <goal>addTestSources</goal>
              <goal>compileTests</goal>
              <goal>compile</goal>     
              <goal>generateTestStubs</goal>
              <goal>generateStubs</goal>
              <goal>removeStubs</goal>
              <goal>removeTestStubs</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
         <testSources>
            <testSource>
              <includes>
                 <include>**/*.groovy</include>
              </includes>
            </testSource>
          </testSources>
        </configuration>
      </plugin>
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.12.1:generateTestStubs (default) on project cclas-test-automation: Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.12.1:generateTestStubs failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.12.1:generateTestStubs (default) on project cclas-test-automation: Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.12.1:generateTestStubs failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.codehaus.gmavenplus:gmavenplus-plugin:1.12.1:generateTestStubs failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: java.lang.NullPointerException
    at java.io.File.<init> (File.java:277)
    at org.apache.maven.shared.model.fileset.util.FileSetManager.scan (FileSetManager.java:640)
    at org.apache.maven.shared.model.fileset.util.FileSetManager.getIncludedFiles (FileSetManager.java:190)
    at org.codehaus.gmavenplus.mojo.AbstractGroovySourcesMojo.getTestFiles (AbstractGroovySourcesMojo.java:78)
    at org.codehaus.gmavenplus.mojo.GenerateTestStubsMojo.execute (GenerateTestStubsMojo.java:79)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:190)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
keeganwitt commented 3 years ago

I'm having trouble reproducing this. I thought maybe it'd happen in a project that didn't have any groovy files in it, but that wasn't the issue. What version of Maven are you using?

You probably don't need the <testSources> anyway. But one thing you might try if you want to have it is to also specify a directory to apply the pattern to, like

<testSources>
    <testSource>
        <directory>${project.basedir}/src/test/groovy</directory>
        <includes>
            <include>**/*.groovy</include>
        </includes>
    </testSource>
</testSources>

I'm not sure if that's the cause (I haven't been able to reproduce it), but might be something to try.

jeacott1 commented 3 years ago

@keeganwitt maven 3.6.3, Java version: 1.8.0_202 thousands of groovy files, and a few java files mixed in. I haven't seen this issue before but its incredibly consistent with this project.

I've had to resort to using the maven ant plugin to build this project for the moment, which is working - the maven-eclipse groovy plugin doesn't come close. I'll try the test-sources with the dir.

keeganwitt commented 3 years ago

What's the structure? Are all those files in src? Or in several directories? Just trying to get an idea of things to try to reproduce.

keeganwitt commented 2 years ago

Closing issue for now, but if you can provide information on how to reproduce, I'll reopen.