1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.scala_tools.maven;
17
18 import java.io.File;
19 import java.util.List;
20
21 import org.apache.maven.model.Dependency;
22 import org.apache.maven.plugin.MojoExecutionException;
23 import org.apache.maven.plugin.MojoFailureException;
24
25
26
27
28
29
30
31
32
33 public class ScalaTestCompileMojo extends ScalaCompilerSupport {
34
35
36
37
38
39
40
41 protected boolean skip;
42
43
44
45
46 protected File testOutputDir;
47
48
49
50
51 protected File testSourceDir;
52
53 @Override
54 public void execute() throws MojoExecutionException, MojoFailureException {
55 if (skip) {
56 return;
57 }
58 super.execute();
59 }
60
61 @SuppressWarnings("unchecked")
62 @Override
63 protected List<String> getClasspathElements() throws Exception {
64 return project.getTestClasspathElements();
65 }
66
67 @SuppressWarnings("unchecked")
68 @Override
69 protected List<Dependency> getDependencies() {
70 return project.getTestDependencies();
71 }
72
73 @Override
74 protected File getOutputDir() throws Exception {
75 return testOutputDir.getAbsoluteFile();
76 }
77
78
79
80
81 protected List<String> getSourceDirectories() throws Exception {
82 List<String> sources = project.getTestCompileSourceRoots();
83 String scalaSourceDir = testSourceDir.getAbsolutePath();
84 if(!sources.contains(scalaSourceDir)) {
85 sources.add(scalaSourceDir);
86 }
87 return sources;
88 }
89 }