scala for source & groovy for tests?

Hi everyone,

I'd like to ask one simple question: Is it possible to write a maven project's source in scala and the tests in groovy?
I tried it and couldn't make it work (the groovy class can't find/see the scala class).

Cheers,
stephanos

2 comments

Short answer, yes. Hope this helps.

            <plugin>                 <groupId>org.codehaus.mojo</groupId>                 <artifactId>build-helper-maven-plugin</artifactId>                 <executions>                     <execution>                         <id>add-source</id>                         <phase>generate-sources</phase>                         <goals>                             <goal>add-source</goal>                         </goals>                         <configuration>                             <sources>                                 <source>src/main/groovy</source>                                 <source>src/main/java</source>                                 <source>src/main/scala</source>                             </sources>                         </configuration>                     </execution>                     <execution>                         <id>add-test-source</id>                         <phase>generate-sources</phase>                         <goals>                             <goal>add-test-source</goal>                         </goals>                         <configuration>                             <sources>                                 <source>src/test/groovy</source>                                 <source>src/test/java</source>                                 <source>src/test/scala</source>                             </sources>                         </configuration>                     </execution>                 </executions>             </plugin>

0

Thanks for your reply! I created a specific test project and was now able to get it working :-)

PS: I attached the project's sources to this thread in case somebody also struggles with this.



Attachment(s):
test.zip
0

Please sign in to leave a comment.