Compiling .class
files with debugging information needs to be done at the maven-scala-plugin
level. Doing it at the maven-compiler-plugin
- which is by the way the default as we can see in the documentation of the debug
option that defaults to true - is useless as it s not compiling your Scala sources.
Now, if we look at the scalac
man page, the scalac
compiler has a –g
option that can take the following values:
"none
" generates no debugging info,
"source
" generates only the source file attribute,
"line
" generates source and line number information,
"vars
" generates source, line number and local variable information,
"notc
" generates all of the above and will not perform tail call optimization.
The good news is that scala:compile
has a nice args
optional parameter that can be used to pass compiler additionnals arguments. So, to use it and pass the -g
option to the scala compiler, you just need to configure the maven plugin as follow:
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-g:notc</arg>
</args>
...
</configuration>
</plugin>
I m skipping other parts of the configuration (such are repositories
, pluginRepositories
, etc) as this is not what you re asking for :)