Skip to content

Commit e6d922e

Browse files
froqueslandelle
authored andcommitted
Fixes support for Maven 4 immutable API
1 parent 536c29e commit e6d922e

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
try {
2-
31
def file = new File(basedir, 'target')
4-
assert !file.exists()
52

6-
return true
3+
if (file.exists()){
4+
def targetEmpty = file.listFiles()
5+
.findAll { it.name != "project-local-repo" }
6+
.isEmpty()
77

8-
} catch(Throwable e) {
9-
e.printStackTrace()
10-
return false
8+
return targetEmpty
119
}
10+
11+
return true

src/main/java/scala_maven/ScalaDocMojo.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,10 @@ public class ScalaDocMojo extends ScalaSourceMojoSupport implements MavenReport
6464

6565
@Override
6666
protected List<File> getSourceDirectories() throws Exception {
67-
List<String> sources = project.getCompileSourceRoots();
6867
// Quick fix in case the user has not added the "add-source" goal.
6968
String scalaSourceDir = FileUtils.pathOf(sourceDir, useCanonicalPath);
70-
if (!sources.contains(scalaSourceDir)) {
71-
sources.add(scalaSourceDir);
72-
}
69+
project.addCompileSourceRoot(scalaSourceDir);
70+
List<String> sources = project.getCompileSourceRoots();
7371
return normalize(sources);
7472
}
7573

src/main/java/scala_maven/ScalaTestCompileMojo.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,9 @@ protected File getOutputDir() {
7777

7878
@Override
7979
protected List<File> getSourceDirectories() throws Exception {
80-
List<String> sources = project.getTestCompileSourceRoots();
8180
String scalaSourceDir = testSourceDir.getAbsolutePath();
82-
if (!sources.contains(scalaSourceDir)) {
83-
sources.add(scalaSourceDir);
84-
}
81+
project.addTestCompileSourceRoot(scalaSourceDir);
82+
List<String> sources = project.getTestCompileSourceRoots();
8583
return normalize(sources);
8684
}
8785

0 commit comments

Comments
 (0)