RepositoryGenerator { protected void generateMarkerFileInRepositoryFolder(File repositoryFile) throws IOException { File markerFile = new File(repositoryFile, ".marker"); try { FileUtils.checkReadOnly(repositoryFile); markerFile.createNewFile(); } catch (IOException e) { throw new IOException(format("The current repository has no artifacts to install, and trying to create [%s] failed", markerFile.toString()), e); } } RepositoryGenerator(File projectPomFile, File outputDirectory, ArtifactInstaller artifactInstaller,
                             ApplicationClassLoaderModelAssembler applicationClassLoaderModelAssembler,
                             ApplicationGAVModel appGAVModel); @Deprecated ClassLoaderModel generate(); @Deprecated ClassLoaderModel generate(boolean lightweight, boolean useLocalRepository, boolean prettyPrinting,
                                   boolean includeTestDependencies); ClassLoaderModel generate(boolean lightweight, boolean useLocalRepository, boolean prettyPrinting,
                                   boolean includeTestDependencies, Optional<MavenReactorResolver> mavenReactorResolver); @Deprecated ClassLoaderModel generate(boolean lightweight);  }
@Test public void generateMarkerFileInRepositoryFolderTest() throws IOException { File generatedMarkerFile = new File(temporaryFolder.getRoot(), ".marker"); assertThat("Marker file already exists", !generatedMarkerFile.exists()); repositoryGenerator.generateMarkerFileInRepositoryFolder(temporaryFolder.getRoot()); assertThat("Marker file was not generated", generatedMarkerFile.exists()); }
@Test public void generateMarkerFileInRepositoryFolderWhenFolderIsNotWritableTest() throws IOException { exception.expect(IOException.class); File generatedMarkerFile = new File(temporaryFolder.getRoot(), ".marker"); assertThat("Marker file already exists", !generatedMarkerFile.exists()); File readOnlyFolder = temporaryFolder.getRoot(); FileUtils.markAsReadOnly(readOnlyFolder); repositoryGenerator.generateMarkerFileInRepositoryFolder(readOnlyFolder); }