diff --git a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala
index 6126424..cfb481a 100644
--- a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala
+++ b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala
@@ -313,17 +313,17 @@ object MojoImplementation {
val dir = Paths.get(a.getDirectory())
if (Files.exists(dir)) {
if (a.getIncludes().isEmpty() && a.getExcludes().isEmpty()) {
- Some(dir)
+ List(dir)
} else {
val scanner = new DirectoryScanner()
scanner.setBasedir(a.getDirectory())
scanner.setIncludes(a.getIncludes().toArray(new Array[String](0)))
scanner.setExcludes(a.getExcludes().toArray(new Array[String](0)))
scanner.scan()
- scanner.getIncludedFiles().map(f => dir.resolve(f))
+ scanner.getIncludedFiles().toList.map(f => dir.resolve(f))
}
- } else None
- case _ => None
+ } else Nil
+ case _ => Nil
})
val project = Config.Project(name, baseDirectory, Some(root.toPath), sourceDirs, None, None, fullDependencies, classpath, out, classesDir, resources, `scala`, java, sbt, test, platform, resolution, Some(tags), None)
Config.File(Config.File.LatestVersion, project)
diff --git a/src/test/resources/default_resources/pom.xml b/src/test/resources/default_resources/pom.xml
new file mode 100644
index 0000000..7090c13
--- /dev/null
+++ b/src/test/resources/default_resources/pom.xml
@@ -0,0 +1,19 @@
+
+ 4.0.0
+
+ bloop.test
+ default_resources
+ 1.0-SNAPSHOT
+ jar
+
+ default-resources-test
+
+
+
+
+ ${project.basedir}/src/main/resources
+
+
+
+
diff --git a/src/test/resources/with_includes/pom.xml b/src/test/resources/with_includes/pom.xml
new file mode 100644
index 0000000..df023d8
--- /dev/null
+++ b/src/test/resources/with_includes/pom.xml
@@ -0,0 +1,22 @@
+
+ 4.0.0
+
+ bloop.test
+ with_includes
+ 1.0-SNAPSHOT
+ jar
+
+ with-includes-test
+
+
+
+
+ ${project.basedir}/src/main/resources
+
+ included.txt
+
+
+
+
+
diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala
index 1a198b0..3a43b7a 100644
--- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala
+++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala
@@ -379,6 +379,31 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
+ @Test
+ def withIncludes() = {
+ check(
+ "with_includes/pom.xml",
+ extraContent = Map(
+ "with_includes/src/main/resources/included.txt" -> "This file should be included.",
+ "with_includes/src/main/resources/excluded.txt" -> "This file should be excluded."
+ )
+ ) { (configFile, projectName, subprojects) =>
+ assert(subprojects.isEmpty)
+ val resources = configFile.project.resources.getOrElse(Nil)
+
+ val included = resources.find(_.toString.endsWith("included.txt"))
+ val excluded = resources.find(_.toString.endsWith("excluded.txt"))
+
+ assert(included.isDefined, "included.txt should be in resources")
+ assert(excluded.isEmpty, "excluded.txt should NOT be in resources")
+
+ // Ensure the directory itself is not added when we have explicit includes
+ val resourceDir = configFile.project.directory.resolve("src/main/resources").toAbsolutePath
+ val hasResourceDir = resources.exists(_.toAbsolutePath == resourceDir)
+ assert(!hasResourceDir, s"Resource directory $resourceDir should NOT be in resources when includes are specified")
+ }
+ }
+
@Test
def issue85() = {
check(
@@ -401,4 +426,25 @@ class MavenConfigGenerationTest extends BaseConfigSuite {
}
}
+ @Test
+ def defaultResources() = {
+ check(
+ "default_resources/pom.xml",
+ extraContent = Map(
+ "default_resources/src/main/resources/hello.txt" -> "hello"
+ )
+ ) { (configFile, projectName, subprojects) =>
+ assert(subprojects.isEmpty)
+ val resources = configFile.project.resources.getOrElse(Nil)
+ // When no includes/excludes are specified, the whole directory should be included
+ val resourceDir = configFile.project.directory.resolve("src/main/resources").toAbsolutePath
+ val hasResourceDir = resources.exists(_.toAbsolutePath == resourceDir)
+ assert(hasResourceDir, s"Resource directory $resourceDir SHOULD be in resources")
+
+ // Individual files should NOT be listed
+ val hasFile = resources.exists(_.toString.endsWith("hello.txt"))
+ assert(!hasFile, "Individual files inside resource dir should NOT be in resources list")
+ }
+ }
+
}