Compile scala classes with debug information via Maven

I have a scala project that I use Maven and maven-scala-plugin to compile. I need to include debugging information in compiled classes, and I was wondering if there is a way to ask Maven or the scala plugin for this. I found this page , which makes it possible, but it is not clear where to put params in pom.xml.

If possible, I would like this parameter to be something specified in pom.xml, and not on the command line.

+3
source share
1 answer

.classDebugging information files should be compiled at the level maven-scala-plugin. Doing this in maven-compiler-plugin- this, by the way, is the default, as we see in the documentation debug, which defaults to true - is useless since it does not compile your Scala sources.

Now, if we look at the scalac man page , the compiler scalachas a parameter –gthat can take the following values:

"none" ,
"source" ,
"line" ,
"vars" , ,
"notc" .

, scala:compile args , . , -g Scala, maven :

  <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>

( repositories, pluginRepositories ..), , :)

+9

Source: https://habr.com/ru/post/1725621/


All Articles