@Test public void testGetResourceFiles() throws Exception { final Collection<String> actualFiles = mojo.getResourceFiles(getFileSets(rootDir), mojo.isFollowLinks(), true, true, false); assertThat(actualFiles).isNotNull().doesNotContainNull().hasSameSizeAs(expectedFiles) .containsOnlyElementsOf(expectedFiles); }
Collection<String> getResourceFiles(final Iterable<? extends FileSet> fileSets, final boolean followLinks, final boolean allowDuplicates, final boolean allowFiles, final boolean allowDirs) throws MojoExecutionException { final Set<String> result = new LinkedHashSet<>(); for (final FileSet fileSet : Objects.requireNonNull(fileSets)) { final Collection<String> files = getResourceFiles(fileSet, followLinks, allowDuplicates, allowFiles, allowDirs); for (final String file : files) { if (!result.add(file) && !allowDuplicates) { getLog() .error( String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); throw new MojoExecutionException(String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); } } } return result; }
ExecMojo extends AbstractMojo { Collection<String> getResourceFiles(final Iterable<? extends FileSet> fileSets, final boolean followLinks, final boolean allowDuplicates, final boolean allowFiles, final boolean allowDirs) throws MojoExecutionException { final Set<String> result = new LinkedHashSet<>(); for (final FileSet fileSet : Objects.requireNonNull(fileSets)) { final Collection<String> files = getResourceFiles(fileSet, followLinks, allowDuplicates, allowFiles, allowDirs); for (final String file : files) { if (!result.add(file) && !allowDuplicates) { getLog() .error( String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); throw new MojoExecutionException(String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); } } } return result; } }
ExecMojo extends AbstractMojo { Collection<String> getResourceFiles(final Iterable<? extends FileSet> fileSets, final boolean followLinks, final boolean allowDuplicates, final boolean allowFiles, final boolean allowDirs) throws MojoExecutionException { final Set<String> result = new LinkedHashSet<>(); for (final FileSet fileSet : Objects.requireNonNull(fileSets)) { final Collection<String> files = getResourceFiles(fileSet, followLinks, allowDuplicates, allowFiles, allowDirs); for (final String file : files) { if (!result.add(file) && !allowDuplicates) { getLog() .error( String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); throw new MojoExecutionException(String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); } } } return result; } @Inject  ExecMojo(final Jsr330Component component); }
ExecMojo extends AbstractMojo { Collection<String> getResourceFiles(final Iterable<? extends FileSet> fileSets, final boolean followLinks, final boolean allowDuplicates, final boolean allowFiles, final boolean allowDirs) throws MojoExecutionException { final Set<String> result = new LinkedHashSet<>(); for (final FileSet fileSet : Objects.requireNonNull(fileSets)) { final Collection<String> files = getResourceFiles(fileSet, followLinks, allowDuplicates, allowFiles, allowDirs); for (final String file : files) { if (!result.add(file) && !allowDuplicates) { getLog() .error( String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); throw new MojoExecutionException(String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); } } } return result; } @Inject  ExecMojo(final Jsr330Component component); @Override void execute(); String getExecLocation(); void setExecLocation(final String execLocation); boolean isExecLocationAsIs(); void setExecLocationAsIs(final boolean execLocationAsIs); boolean isSystemCommand(); void setSystemCommand(final boolean systemCommand); String getArgQuote(); void setArgQuote(final String argQuote); List<String> getArgs(); void setArgs(final List<String> args); File getWorkDir(); void setWorkDir(final File workDir); Map<String, String> getEnvironment(); void setEnvironment(final Map<String, String> environment); String getErrorProperty(); void setErrorProperty(final String errorProperty); File getErrorFile(); void setErrorFile(final File errorFile); boolean isErrorPipe(); void setErrorPipe(final boolean errorPipe); boolean isErrorInherit(); void setErrorInherit(final boolean errorInherit); boolean isErrorAppend(); void setErrorAppend(final boolean errorAppend); String getOutProperty(); void setOutProperty(final String outProperty); File getOutFile(); void setOutFile(final File outFile); boolean isOutPipe(); void setOutPipe(final boolean outPipe); boolean isOutInherit(); void setOutInherit(final boolean outInherit); boolean isOutAppend(); void setOutAppend(final boolean outAppend); int getExitCode(); void setExitCode(final int exitCode); boolean isRedirectErrorStream(); void setRedirectErrorStream(final boolean redirectErrorStream); List<FileSet> getFileSets(); void setFileSets(final List<? extends FileSet> fileSets); boolean isFollowLinks(); void setFollowLinks(final boolean followLinks); boolean isAllowDuplicates(); void setAllowDuplicates(final boolean allowDuplicates); boolean isAllowFiles(); void setAllowFiles(final boolean allowFiles); boolean isAllowDirs(); void setAllowDirs(final boolean allowDirs); }
ExecMojo extends AbstractMojo { Collection<String> getResourceFiles(final Iterable<? extends FileSet> fileSets, final boolean followLinks, final boolean allowDuplicates, final boolean allowFiles, final boolean allowDirs) throws MojoExecutionException { final Set<String> result = new LinkedHashSet<>(); for (final FileSet fileSet : Objects.requireNonNull(fileSets)) { final Collection<String> files = getResourceFiles(fileSet, followLinks, allowDuplicates, allowFiles, allowDirs); for (final String file : files) { if (!result.add(file) && !allowDuplicates) { getLog() .error( String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); throw new MojoExecutionException(String.format("a duplicate file %s under directory %s", file, fileSet.getDirectory())); } } } return result; } @Inject  ExecMojo(final Jsr330Component component); @Override void execute(); String getExecLocation(); void setExecLocation(final String execLocation); boolean isExecLocationAsIs(); void setExecLocationAsIs(final boolean execLocationAsIs); boolean isSystemCommand(); void setSystemCommand(final boolean systemCommand); String getArgQuote(); void setArgQuote(final String argQuote); List<String> getArgs(); void setArgs(final List<String> args); File getWorkDir(); void setWorkDir(final File workDir); Map<String, String> getEnvironment(); void setEnvironment(final Map<String, String> environment); String getErrorProperty(); void setErrorProperty(final String errorProperty); File getErrorFile(); void setErrorFile(final File errorFile); boolean isErrorPipe(); void setErrorPipe(final boolean errorPipe); boolean isErrorInherit(); void setErrorInherit(final boolean errorInherit); boolean isErrorAppend(); void setErrorAppend(final boolean errorAppend); String getOutProperty(); void setOutProperty(final String outProperty); File getOutFile(); void setOutFile(final File outFile); boolean isOutPipe(); void setOutPipe(final boolean outPipe); boolean isOutInherit(); void setOutInherit(final boolean outInherit); boolean isOutAppend(); void setOutAppend(final boolean outAppend); int getExitCode(); void setExitCode(final int exitCode); boolean isRedirectErrorStream(); void setRedirectErrorStream(final boolean redirectErrorStream); List<FileSet> getFileSets(); void setFileSets(final List<? extends FileSet> fileSets); boolean isFollowLinks(); void setFollowLinks(final boolean followLinks); boolean isAllowDuplicates(); void setAllowDuplicates(final boolean allowDuplicates); boolean isAllowFiles(); void setAllowFiles(final boolean allowFiles); boolean isAllowDirs(); void setAllowDirs(final boolean allowDirs);  }