Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created October 16, 2013 14:48
Show Gist options
  • Save diegopacheco/7008905 to your computer and use it in GitHub Desktop.
Save diegopacheco/7008905 to your computer and use it in GitHub Desktop.
Scala Maven Plugin Config
Inside your parent pom.xml:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.1.5</version>
</plugin>
</plugins>
</pluginManagement>
</build>
You can hava mixed java and scala on the same project as long as you have the folders: src/mai/scala, src/main/java, src/main/resources, src/test/scala, src/test/java/, src/test, resources. So in your pom.xml you do:
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
**To run parallel builds with maven 3 you use -T, so you can do $ mvn -T 1.5C clean install, I realize a redution of 3minutes more or less using this on total build time.
@jcranky
Copy link

jcranky commented Oct 17, 2013

Any specific reason why you fixed the maven-compiler-plugin version?

@diegopacheco
Copy link
Author

no, here is just a sample, in real life i use profile variables :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment