From a1e8972d5b91d6817ab7d9476612eafb711d6199 Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Tue, 6 Jan 2026 12:59:39 +0530 Subject: [PATCH 1/7] Fix bloop config suffix collision and update dependency resolution --- .../maven/MojoImplementation.scala | 16 ++++-- .../multi_module_test_jar/bar/pom.xml | 1 + .../multi_module_test_jar/foo/pom.xml | 1 + .../maven/MavenConfigGenerationTest.scala | 51 +++++++++++++++++-- 4 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala index 299a8fb..756c5fd 100644 --- a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala +++ b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala @@ -152,7 +152,7 @@ object MojoImplementation { log.info(s"Dependency $dep, $matchingArtifacts") matchingArtifacts .collect { - case artifact if artifact.getType == "test-jar" => dep.getArtifactId + "-test" + case artifact if artifact.getType == "test-jar" => dep.getArtifactId + "-test-scope" } .toList .appended(dep.getArtifactId) @@ -200,7 +200,11 @@ object MojoImplementation { launcher: Option[AppLauncher], configuration: String ): Unit = { - val suffix = if (configuration == "compile") "" else s"-$configuration" + val suffix = configuration match { + case "compile" => "-compile" + case "test" => "-test-scope" + case _ => s"-$configuration" + } val name = project.getArtifactId() + suffix val build = project.getBuild() val baseDirectory = abs(project.getBasedir()) @@ -293,6 +297,12 @@ object MojoImplementation { log.info(s"Generated $finalTarget") log.debug(s"Configuration to be serialized:\n$config") bloop.config.write(config, configTarget.toPath) + + log.info(s"Starting to write configuration for project: ${project.getArtifactId()} with configuration: $configuration") + log.debug(s"Source directories: ${sourceDirs0.map(_.getAbsolutePath).mkString(", ")}") + log.debug(s"Classpath: ${classpath0().asScala.mkString(", ")}") + log.debug(s"Resources: ${resources0.asScala.mkString(", ")}") + log.debug(s"Output directory: ${classesDir0.getAbsolutePath}") } writeConfig( @@ -354,7 +364,7 @@ object MojoImplementation { throw new IllegalArgumentException(s"Could not resolve $artifact") Config.Module( organization = artifact.getGroupId(), - name = artifact.getArtifactId(), + name = if (artifact.getType == "test-jar") artifact.getArtifactId + "-test-scope" else artifact.getArtifactId, version = artifact.getVersion(), configurations = None, Config.Artifact( diff --git a/src/test/resources/multi_module_test_jar/bar/pom.xml b/src/test/resources/multi_module_test_jar/bar/pom.xml index 21cdd89..9ca9c58 100644 --- a/src/test/resources/multi_module_test_jar/bar/pom.xml +++ b/src/test/resources/multi_module_test_jar/bar/pom.xml @@ -17,6 +17,7 @@ org.scala-lang scala-library + ${scala.version} com.example diff --git a/src/test/resources/multi_module_test_jar/foo/pom.xml b/src/test/resources/multi_module_test_jar/foo/pom.xml index cb550b0..c5c3918 100644 --- a/src/test/resources/multi_module_test_jar/foo/pom.xml +++ b/src/test/resources/multi_module_test_jar/foo/pom.xml @@ -17,6 +17,7 @@ org.scala-lang scala-library + ${scala.version} diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index 278dfb5..0c839da 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -261,6 +261,19 @@ class MavenConfigGenerationTest extends BaseConfigSuite { } } + @Test + def testFallbackNamingForTestScope() = { + check( + "multi_dependency/pom.xml", + submodules = List("multi_dependency/module1/pom.xml", "multi_dependency/module2/pom.xml") + ) { + case (configFile, projectName, List(module1, module2)) => + assert(configFile.project.name.endsWith("-compile")) + assert(module1.project.name.endsWith("-compile")) + assert(module2.project.name.endsWith("-compile")) + } + } + private def check(testProject: String, submodules: List[String] = Nil)( checking: (Config.File, String, List[Config.File]) => Unit ): Unit = { @@ -308,12 +321,21 @@ class MavenConfigGenerationTest extends BaseConfigSuite { val projectPath = outFile.getParent() val projectName = projectPath.toFile().getName() val bloopDir = projectPath.resolve(".bloop") - val projectFile = bloopDir.resolve(s"${projectName}.json") + val projectFile = bloopDir.resolve(s"${projectName}-compile.json") + + // Log the contents of the .bloop directory for debugging + if (bloopDir.toFile().exists()) { + println(".bloop directory contents:") + bloopDir.toFile().listFiles().foreach(file => println(file.getName)) + } else { + println(".bloop directory does not exist!") + } + val configFile = readValidBloopConfig(projectFile.toFile()) val subProjects = submodules.map { mod => val subProjectName = tempDir.resolve(mod).getParent().toFile().getName() - val subProjectFile = bloopDir.resolve(s"${subProjectName}.json") + val subProjectFile = bloopDir.resolve(s"${subProjectName}-compile.json") readValidBloopConfig(subProjectFile.toFile()) } checking(configFile, projectName, subProjects) @@ -345,7 +367,7 @@ class MavenConfigGenerationTest extends BaseConfigSuite { val processBuilder = new ProcessBuilder() val out = new StringBuilder() processBuilder.directory(cwd) - processBuilder.command(cmd: _*); + processBuilder.command(cmd: _*) var process = processBuilder.start() val reader = @@ -354,10 +376,33 @@ class MavenConfigGenerationTest extends BaseConfigSuite { var line = reader.readLine() while (line != null) { out.append(line + "\n") + println(line) // Added logging for debugging line = reader.readLine() } + + val exitCode = process.waitFor() + if (exitCode != 0) { + println("Command failed with exit code: " + exitCode) + println("Error output: " + lastError.toString()) + } + out.toString() } } + def exec(command: String, cwd: File): Unit = { + println(s"Executing command: $command in directory: ${cwd.getAbsolutePath}") + val process = new ProcessBuilder(command.split(" "): _*) + .directory(cwd) + .redirectErrorStream(true) + .start() + + val output = scala.io.Source.fromInputStream(process.getInputStream).mkString + println(s"Command output: \n$output") + + val exitCode = process.waitFor() + println(s"Command exited with code: $exitCode") + assert(exitCode == 0, s"Command failed with exit code $exitCode. Output: \n$output") + } + } From 4c51dbb4ae72a4ca089681d79811193ef75bdd2c Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Wed, 7 Jan 2026 19:46:18 +0530 Subject: [PATCH 2/7] fix: dynamic suffix to avoid config collisions --- .../maven/MojoImplementation.scala | 38 ++++++++++++++----- .../maven/MavenConfigGenerationTest.scala | 36 +++++------------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala index 756c5fd..1a40b07 100644 --- a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala +++ b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala @@ -128,6 +128,19 @@ object MojoImplementation { } } + val reactorArtifactIds = mojo.getReactorProjects().asScala.map(_.getArtifactId).toSet + + def getBloopName(artifactId: String, configuration: String): String = { + configuration match { + case "test" => + val defaultName = s"$artifactId-test" + if (reactorArtifactIds.contains(defaultName)) s"$artifactId-test-scope" + else defaultName + case "compile" => artifactId + case _ => s"$artifactId-$configuration" + } + } + val reactorProjectsSet = mojo .getReactorProjects() .asScala @@ -152,7 +165,7 @@ object MojoImplementation { log.info(s"Dependency $dep, $matchingArtifacts") matchingArtifacts .collect { - case artifact if artifact.getType == "test-jar" => dep.getArtifactId + "-test-scope" + case artifact if artifact.getType == "test-jar" => getBloopName(dep.getArtifactId, "test") } .toList .appended(dep.getArtifactId) @@ -200,12 +213,7 @@ object MojoImplementation { launcher: Option[AppLauncher], configuration: String ): Unit = { - val suffix = configuration match { - case "compile" => "-compile" - case "test" => "-test-scope" - case _ => s"-$configuration" - } - val name = project.getArtifactId() + suffix + val name = getBloopName(project.getArtifactId(), configuration) val build = project.getBuild() val baseDirectory = abs(project.getBasedir()) val out = baseDirectory.resolve("target") @@ -243,7 +251,7 @@ object MojoImplementation { if (mojo.shouldDownloadSources()) { resolveArtifact(art, sources = true) } - artifactToConfigModule(art, project, session) + artifactToConfigModule(art, project, session, reactorArtifactIds) } val resolution = Some(Config.Resolution(modules.toList)) @@ -338,7 +346,8 @@ object MojoImplementation { private def artifactToConfigModule( artifact: Artifact, project: MavenProject, - session: MavenSession + session: MavenSession, + reactorArtifactIds: Set[String] ): Config.Module = { val base = session.getLocalRepository().getBasedir() val artifactRelativePath = session.getLocalRepository().pathOf(artifact) @@ -362,9 +371,18 @@ object MojoImplementation { } if (artifact.getFile() == null) throw new IllegalArgumentException(s"Could not resolve $artifact") + + val name = if (artifact.getType == "test-jar") { + val defaultName = artifact.getArtifactId + "-test" + if (reactorArtifactIds.contains(defaultName)) artifact.getArtifactId + "-test-scope" + else defaultName + } else { + artifact.getArtifactId + } + Config.Module( organization = artifact.getGroupId(), - name = if (artifact.getType == "test-jar") artifact.getArtifactId + "-test-scope" else artifact.getArtifactId, + name = name, version = artifact.getVersion(), configurations = None, Config.Artifact( diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index 0c839da..1f1772b 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -268,9 +268,14 @@ class MavenConfigGenerationTest extends BaseConfigSuite { submodules = List("multi_dependency/module1/pom.xml", "multi_dependency/module2/pom.xml") ) { case (configFile, projectName, List(module1, module2)) => - assert(configFile.project.name.endsWith("-compile")) - assert(module1.project.name.endsWith("-compile")) - assert(module2.project.name.endsWith("-compile")) + // Standard naming should be preserved when no collision exists + assert(!configFile.project.name.contains("-compile")) + assert(!module1.project.name.contains("-compile")) + assert(!module2.project.name.contains("-compile")) + + // Note: To test actual collision, we would need to construct a project structure + // where a submodule name conflicts with the test suffix of another module. + // For now, we verify that the default behavior is correct (no suffixes). } } @@ -321,21 +326,13 @@ class MavenConfigGenerationTest extends BaseConfigSuite { val projectPath = outFile.getParent() val projectName = projectPath.toFile().getName() val bloopDir = projectPath.resolve(".bloop") - val projectFile = bloopDir.resolve(s"${projectName}-compile.json") - - // Log the contents of the .bloop directory for debugging - if (bloopDir.toFile().exists()) { - println(".bloop directory contents:") - bloopDir.toFile().listFiles().foreach(file => println(file.getName)) - } else { - println(".bloop directory does not exist!") - } + val projectFile = bloopDir.resolve(s"${projectName}.json") val configFile = readValidBloopConfig(projectFile.toFile()) val subProjects = submodules.map { mod => val subProjectName = tempDir.resolve(mod).getParent().toFile().getName() - val subProjectFile = bloopDir.resolve(s"${subProjectName}-compile.json") + val subProjectFile = bloopDir.resolve(s"${subProjectName}.json") readValidBloopConfig(subProjectFile.toFile()) } checking(configFile, projectName, subProjects) @@ -390,19 +387,6 @@ class MavenConfigGenerationTest extends BaseConfigSuite { } } - def exec(command: String, cwd: File): Unit = { - println(s"Executing command: $command in directory: ${cwd.getAbsolutePath}") - val process = new ProcessBuilder(command.split(" "): _*) - .directory(cwd) - .redirectErrorStream(true) - .start() - - val output = scala.io.Source.fromInputStream(process.getInputStream).mkString - println(s"Command output: \n$output") - val exitCode = process.waitFor() - println(s"Command exited with code: $exitCode") - assert(exitCode == 0, s"Command failed with exit code $exitCode. Output: \n$output") - } } From c18fce20b46948488aa15fa18260f4f054066347 Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Wed, 7 Jan 2026 20:13:43 +0530 Subject: [PATCH 3/7] fix: resolve non-exhaustive match warning in tests --- .../integrations/maven/MavenConfigGenerationTest.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index 0d0f8eb..ef84458 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -267,7 +267,12 @@ class MavenConfigGenerationTest extends BaseConfigSuite { "multi_dependency/pom.xml", submodules = List("multi_dependency/module1/pom.xml", "multi_dependency/module2/pom.xml") ) { - case (configFile, projectName, List(module1, module2)) => + case (configFile, projectName, submodulesList) => + val (module1: Config.File, module2: Config.File) = submodulesList match { + case List(m1, m2) => (m1, m2) + case _ => fail(s"Expected 2 submodules, but got ${submodulesList.size}") + } + // Standard naming should be preserved when no collision exists assert(!configFile.project.name.contains("-compile")) assert(!module1.project.name.contains("-compile")) From 6c019dc9774fbb5e08122a8ad1897318f54ec850 Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Wed, 7 Jan 2026 20:59:34 +0530 Subject: [PATCH 4/7] fix: resolve compilation errors and test failures --- .../scala/bloop/integrations/maven/MojoImplementation.scala | 2 +- .../integrations/maven/MavenConfigGenerationTest.scala | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala index a662a51..aa50e02 100644 --- a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala +++ b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala @@ -271,7 +271,7 @@ object MojoImplementation { resolveArtifact(artifact) match { case Some(file) => artifact.setFile(file) - val module = artifactToConfigModule(artifact, project, session) + val module = artifactToConfigModule(artifact, project, session, reactorArtifactIds) (modules0.toList :+ module, List(file.toPath)) case None => (modules0.toList, Nil) diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index ef84458..c952eba 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -218,7 +218,7 @@ class MavenConfigGenerationTest extends BaseConfigSuite { assert(hasCompileClasspathEntryName(configFile, "scala-library")) assert(hasTag(configFile, Tag.Library)) - val testJar = configFile.project.resolution.get.modules.find(_.name == "spark-tags_2.13") + val testJar = configFile.project.resolution.get.modules.find(_.name == "spark-tags_2.13-test") assert( testJar.forall( _.artifacts.exists(e => @@ -281,6 +281,10 @@ class MavenConfigGenerationTest extends BaseConfigSuite { // Note: To test actual collision, we would need to construct a project structure // where a submodule name conflicts with the test suffix of another module. // For now, we verify that the default behavior is correct (no suffixes). + } + } + + @Test def junitSupport() = { check("junit_project/pom.xml") { (configFile, projectName, subprojects) => assert(subprojects.isEmpty) From f7c63ddb36c78e9ff2eca5b03ce2df540e6a4916 Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Thu, 8 Jan 2026 23:25:50 +0530 Subject: [PATCH 5/7] Address review: generalize getBloopName and remove unused code --- .../maven/MojoImplementation.scala | 20 +++++-------------- .../maven/MavenConfigGenerationTest.scala | 1 - 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala index aa50e02..12af8fd 100644 --- a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala +++ b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala @@ -132,12 +132,11 @@ object MojoImplementation { def getBloopName(artifactId: String, configuration: String): String = { configuration match { - case "test" => - val defaultName = s"$artifactId-test" - if (reactorArtifactIds.contains(defaultName)) s"$artifactId-test-scope" - else defaultName case "compile" => artifactId - case _ => s"$artifactId-$configuration" + case _ => + val defaultName = s"$artifactId-$configuration" + if (reactorArtifactIds.contains(defaultName)) s"$artifactId-$configuration-scope" + else defaultName } } @@ -399,18 +398,9 @@ object MojoImplementation { } if (artifact.getFile() == null) throw new IllegalArgumentException(s"Could not resolve $artifact") - - val name = if (artifact.getType == "test-jar") { - val defaultName = artifact.getArtifactId + "-test" - if (reactorArtifactIds.contains(defaultName)) artifact.getArtifactId + "-test-scope" - else defaultName - } else { - artifact.getArtifactId - } - Config.Module( organization = artifact.getGroupId(), - name = name, + name = artifact.getArtifactId(), version = artifact.getVersion(), configurations = None, Config.Artifact( diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index c952eba..d920811 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -398,7 +398,6 @@ class MavenConfigGenerationTest extends BaseConfigSuite { var line = reader.readLine() while (line != null) { out.append(line + "\n") - println(line) // Added logging for debugging line = reader.readLine() } From bd477131923e2a50756292ca8366cc10e3c4d664 Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Fri, 9 Jan 2026 22:09:50 +0530 Subject: [PATCH 6/7] fix: resolve module naming conflicts using session projects --- .../maven/MojoImplementation.scala | 9 ++-- .../conflicting_modules/module1-test/pom.xml | 33 +++++++++++++++ .../conflicting_modules/module1/pom.xml | 33 +++++++++++++++ .../resources/conflicting_modules/pom.xml | 21 ++++++++++ .../maven/MavenConfigGenerationTest.scala | 41 ++++++++++++++++++- 5 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 src/test/resources/conflicting_modules/module1-test/pom.xml create mode 100644 src/test/resources/conflicting_modules/module1/pom.xml create mode 100644 src/test/resources/conflicting_modules/pom.xml diff --git a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala index 12af8fd..5c3c40a 100644 --- a/src/main/scala/bloop/integrations/maven/MojoImplementation.scala +++ b/src/main/scala/bloop/integrations/maven/MojoImplementation.scala @@ -128,7 +128,7 @@ object MojoImplementation { } } - val reactorArtifactIds = mojo.getReactorProjects().asScala.map(_.getArtifactId).toSet + val reactorArtifactIds = session.getProjects().asScala.map(_.getArtifactId).toSet def getBloopName(artifactId: String, configuration: String): String = { configuration match { @@ -250,7 +250,7 @@ object MojoImplementation { if (mojo.shouldDownloadSources()) { resolveArtifact(art, sources = true) } - artifactToConfigModule(art, project, session, reactorArtifactIds) + artifactToConfigModule(art, project, session) } val (modules, extraClasspath) = { @@ -270,7 +270,7 @@ object MojoImplementation { resolveArtifact(artifact) match { case Some(file) => artifact.setFile(file) - val module = artifactToConfigModule(artifact, project, session, reactorArtifactIds) + val module = artifactToConfigModule(artifact, project, session) (modules0.toList :+ module, List(file.toPath)) case None => (modules0.toList, Nil) @@ -373,8 +373,7 @@ object MojoImplementation { private def artifactToConfigModule( artifact: Artifact, project: MavenProject, - session: MavenSession, - reactorArtifactIds: Set[String] + session: MavenSession ): Config.Module = { val base = session.getLocalRepository().getBasedir() val artifactRelativePath = session.getLocalRepository().pathOf(artifact) diff --git a/src/test/resources/conflicting_modules/module1-test/pom.xml b/src/test/resources/conflicting_modules/module1-test/pom.xml new file mode 100644 index 0000000..5081e19 --- /dev/null +++ b/src/test/resources/conflicting_modules/module1-test/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.example + module1-test + 0.1 + module1-test + + + com.example + conflicting_modules + 0.1 + + + + + org.scala-lang + scala-library + 2.13.6 + + + + + src/main/scala + src/test/scala + + + net.alchim31.maven + scala-maven-plugin + 3.3.2 + + + + diff --git a/src/test/resources/conflicting_modules/module1/pom.xml b/src/test/resources/conflicting_modules/module1/pom.xml new file mode 100644 index 0000000..ef3ee37 --- /dev/null +++ b/src/test/resources/conflicting_modules/module1/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.example + module1 + 0.1 + module1 + + + com.example + conflicting_modules + 0.1 + + + + + org.scala-lang + scala-library + 2.13.6 + + + + + src/main/scala + src/test/scala + + + net.alchim31.maven + scala-maven-plugin + 3.3.2 + + + + diff --git a/src/test/resources/conflicting_modules/pom.xml b/src/test/resources/conflicting_modules/pom.xml new file mode 100644 index 0000000..252505a --- /dev/null +++ b/src/test/resources/conflicting_modules/pom.xml @@ -0,0 +1,21 @@ + + 4.0.0 + com.example + conflicting_modules + 0.1 + pom + conflicting_modules + Project with conflicting module names. + + + 1.8 + 1.8 + UTF-8 + + + + module1 + module1-test + + + diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index d920811..76c932e 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -203,6 +203,45 @@ class MavenConfigGenerationTest extends BaseConfigSuite { } } + @Test + def conflictingSubmodules() = { + check( + "conflicting_modules/pom.xml", + submodules = List( + "conflicting_modules/module1/pom.xml", + "conflicting_modules/module1-test/pom.xml" + ) + ) { + case (configFile, projectName, List(module1, module2)) => + // module1 is "module1" + // module2 is "module1-test" + + // module1's test configuration should be renamed to avoid conflict with module2 + // Default would be "module1-test", but "module1-test" exists as a reactor artifact (module2) + // So it should be "module1-test-scope" + assertEquals("module1", module1.project.name) + + // We need to check the test configuration name for module1. + // check() function loads the "compile" configuration (default expectation in this test suite assumption?) + // Actually check() loads the config based on the project file name. + // module1 comes from "conflicting_modules/module1/pom.xml" -> parent dir is "module1". + // The bloop file loaded is "module1.json". + + // Let's check the test config of module1 + val module1TestConfigPath = configFile.project.directory.resolve(".bloop").resolve("module1-test-scope.json") + assertTrue(s"Test config for module1 should be renamed to module1-test-scope.json", Files.exists(module1TestConfigPath)) + + val module1TestConfig = readValidBloopConfig(module1TestConfigPath.toFile()) + assertEquals("module1-test-scope", module1TestConfig.project.name) + + // module2 should start with module1-test + assertEquals("module1-test", module2.project.name) + + case _ => + fail("Conflicting modules test should have 2 submodules") + } + } + @Test def dependencyTestJars() = { check("test_jars/pom.xml") { (configFile, projectName, subprojects) => @@ -218,7 +257,7 @@ class MavenConfigGenerationTest extends BaseConfigSuite { assert(hasCompileClasspathEntryName(configFile, "scala-library")) assert(hasTag(configFile, Tag.Library)) - val testJar = configFile.project.resolution.get.modules.find(_.name == "spark-tags_2.13-test") + val testJar = configFile.project.resolution.get.modules.find(_.name == "spark-tags_2.13") assert( testJar.forall( _.artifacts.exists(e => From 72a95e736db57208bbfd1cd78a992e3948f0cb6f Mon Sep 17 00:00:00 2001 From: krrish175-byte Date: Fri, 9 Jan 2026 22:47:35 +0530 Subject: [PATCH 7/7] chore: remove debug println statements --- .../bloop/integrations/maven/MavenConfigGenerationTest.scala | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala index a56604c..e1dfd61 100644 --- a/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala +++ b/src/test/scala/bloop/integrations/maven/MavenConfigGenerationTest.scala @@ -438,10 +438,6 @@ class MavenConfigGenerationTest extends BaseConfigSuite { } val exitCode = process.waitFor() - if (exitCode != 0) { - println("Command failed with exit code: " + exitCode) - println("Error output: " + lastError.toString()) - } out.toString() }