Java 类org.apache.maven.plugin.testing.ArtifactStubFactory 实例源码

项目:che    文件:ProjectStub.java   
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);
}
项目:mavennatives    文件:CopyNativesMojoTest.java   
@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());
}
项目:illegal-transitive-dependency-check    文件:IllegalTransitiveDependencyCheckTest.java   
@Before
public void prepareArtifactStubFactory() throws IOException {
  factory = new ArtifactStubFactory();
  factory.setWorkingDir(folder.newFolder("repository"));
  factory.setCreateFiles(true);
}