maven-compiler-plugin seems to compile Java classes first. Not seeing any of my Groovy classes

704 views
Skip to first unread message

bytor...@gmail.com

unread,
Jun 19, 2015, 3:58:20 PM6/19/15
to gmave...@googlegroups.com
I followed the documentation exactly. with 

<plugin>
   
<groupId>org.codehaus.gmavenplus</groupId>
   
<artifactId>gmavenplus-plugin</artifactId>
   
<version>${maven.gmavenplus.plugin.version}</version>
   
<executions>
       
<execution>
           
<goals>
               
<goal>addSources</goal>
               
<goal>addTestSources</goal>
               
<goal>generateStubs</goal>
               
<goal>compile</goal>
               
<goal>testGenerateStubs</goal>
               
<goal>testCompile</goal>
               
<goal>removeStubs</goal>
               
<goal>removeTestStubs</goal>
           
</goals>
       
</execution>
   
</executions>
</plugin>
<plugin>
   
<groupId>org.apache.maven.plugins</groupId>
   
<artifactId>maven-compiler-plugin</artifactId>
   
<version>${maven.compiler.plugin.version}</version>
   
<configuration>
     
<source>${maven.compiler.java.version}</source>
     
<target>${maven.compiler.java.version}</target>
     
<verbose>false</verbose>
     
<encoding>UTF-8</encoding>
   
</configuration>
</plugin>


However, I get errors when the Java classes are being compiled by the maven-compiler-plugin "cannot find symbol" for any class the Java classes use that were in Groovy. So no Groovy code is being compiled and put into a place where the Java compilation can find them, if so. Here is what a small portion of the maven output looks like..

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ game-core ---
[INFO] Deleting /Users/mark/devroot/projects/hdpoker/game-core/target
[INFO]
[INFO] --- gmavenplus-plugin:1.5:addSources (default) @ game-core ---
[INFO]
[INFO] --- gmavenplus-plugin:1.5:addTestSources (default) @ game-core ---
[INFO]
[INFO] --- gmavenplus-plugin:1.5:generateStubs (default) @ game-core ---
[INFO] No sources specified for stub generation.  Skipping.
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ game-core ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ game-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 99 source files to /Users/mark/devroot/projects/hdpoker/game-core/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/mark/devroot/projects/hdpoker/game-core/src/main/java/com/hdpoker/gameserver/stats/service/BaseStatBook.java:[3,29] package com.hdpoker.cassandra does not exist
[ERROR] /Users/mark/devroot/projects/hdpoker/game-core/src/main/java/com/hdpoker/data/stats/SessionStatsCleanup.java:[5,35] cannot find symbol
  symbol:   class SessionManager
  location: package com.hdpoker.gameserver.core
[ERROR] /Users/mark/devroot/projects/hdpoker/game-core/src/main/java/com/hdpoker/data/stats/SessionStatsCleanup.java:[6,35] cannot find symbol
  symbol:   class SessionManagerImpl
  location: package com.hdpoker.gameserver.core

So SessionManager and SessionManagerImpl are both written in Groovy, and as you can see BaseStatBook and SessionStatsCleanup are Java code.

What am I doing wrong?

Thanks

Mark

bytor...@gmail.com

unread,
Jun 19, 2015, 5:16:33 PM6/19/15
to gmave...@googlegroups.com
I am wondering if it might be because we don't keep our .groovy files separated from the .java files in our src/main/java directory. We do NOT have a src/main/groovy directory. But that really shouldn't be a requirement.

Thanks

Mark

Keegan Witt

unread,
Jun 19, 2015, 5:27:43 PM6/19/15
to gmave...@googlegroups.com
That's likely the issue.  GMavenPlus uses src/main/groovy and src/test/groovy as the defaults (just like the regular compiler plugin has src/main/java and src/test/java as the defaults).  If you want to use other directories, you just have to tell GMavenPlus where to look, as documented here.  In your case you'd have something like
<sources>
  <source>
    <directory>${project.basedir}/src/main/java</directory>
    <includes>
      <include>**/*.groovy</include>
    </includes>
  </source>
</sources>
and if you also have Groovy tests, you'd add something like
<testSources>
  <testSource>
    <directory>${project.basedir}/src/test/java</directory>
    <includes>
      <include>**/*.groovy</include>
    </includes>
  </testSource>
</testSources>
Both of these would go in GMavenPlus's <configuration>.

-Keegan

--
You received this message because you are subscribed to the Google Groups "GMavenPlus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gmavenplus+...@googlegroups.com.
To post to this group, send email to gmave...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gmavenplus/1ddfbef6-cbf0-4427-a959-a169a6ffadab%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages