void () { String firstModuleDescriptor = createFile("first/src/module-info.java", "module first { requires second; }"); String firstModuleName = "first"; JpsModule firstModule = addModule(firstModuleName, PathUtil.getParentPath(firstModuleDescriptor)); createFile("first/src/pack1/Foo.java", "package pack1; import pack2.Bar; public class Foo { public void foo() { System.out.println(new Bar().bar()); } }"); String secondModuleDescriptor = createFile("second/src/module-info.java", "module second { exports pack2; }"); String secondModuleName = "second"; JpsModule second = addModule(secondModuleName, PathUtil.getParentPath(secondModuleDescriptor)); createFile("second/src/pack2/Bar.java", "package pack2; public class Bar { public String bar() { return \"bar\"; } }"); firstModule.getDependenciesList().addModuleDependency(second); LayoutElementCreator root = root() .dir(firstModuleName).module(firstModule).end() .dir(secondModuleName).module(second).end(); String artifactName = "jlink"; JpsArtifact artifact = JpsArtifactService.getInstance().addArtifact(myProject, artifactName, root.buildElement(), JpsJLinkArtifactType.INSTANCE, new JpsJLinkProperties(CompressionLevel.SECOND, true)); artifact.setOutputPath(getAbsolutePath("out/artifacts/" + artifactName)); buildArtifacts(artifact); String artifactOutputPath = artifact.getOutputFilePath(); assertTrue(Files.exists(Paths.get(artifactOutputPath, firstModuleName))); assertTrue(Files.exists(Paths.get(artifactOutputPath, secondModuleName))); assertTrue(Files.exists(Paths.get(artifactOutputPath, JLinkArtifactBuildTaskProvider.IMAGE_DIR_NAME))); }