private void setupDependencyArtifacts(Model model) { Set<Artifact> artifacts = new HashSet<>(); ArtifactStubFactory artifactStubFactory = new ArtifactStubFactory(); for (Dependency dependency : model.getDependencies()) { Artifact artifact; try { artifact = artifactStubFactory.createArtifact( dependency.getGroupId(), dependency.getArtifactId(), System.getProperty("currentVersion")); } catch (IOException e) { throw new RuntimeException(e); } List<String> patterns = dependency .getExclusions() .stream() .map(exclusion -> exclusion.getGroupId() + ":" + exclusion.getArtifactId()) .collect(Collectors.toList()); artifact.setDependencyFilter(new ExcludesArtifactFilter(patterns)); artifacts.add(artifact); } setDependencyArtifacts(artifacts); }
@Before public void setUp() { mojo = new CopyNativesMojo(); mavenProject = context.mock(MavenProject.class); mojo.setMavenProject(mavenProject); jarUnpacker = context.mock(JarUnpackable.class); mojo.setJarUnpacker(jarUnpacker); nativesTargetDir = context.mock(File.class); mojo.setNativesTargetDir(nativesTargetDir); artifactFactory = new ArtifactStubFactory(); mojo.setBuildContext(new DefaultBuildContext()); }
@Before public void prepareArtifactStubFactory() throws IOException { factory = new ArtifactStubFactory(); factory.setWorkingDir(folder.newFolder("repository")); factory.setCreateFiles(true); }