コード例 #1
0
  private Artifact makeArtifact(String groupId, String artifactId, String version) {
    Artifact artifact = artifactFactory.createBuildArtifact(groupId, artifactId, version, "jar");

    artifact.setFile(
        getTestFile(
            "src/test/repository/" + groupId + "/jars/" + artifactId + "-" + version + ".jar"));

    return artifact;
  }
コード例 #2
0
  private ArtifactResolutionResult resolveArtifact(
      Artifact filteredArtifact, Artifact providerArtifact)
      throws ArtifactResolutionException, ArtifactNotFoundException {
    ArtifactFilter filter = null;
    if (filteredArtifact != null) {
      filter =
          new ExcludesArtifactFilter(
              Collections.singletonList(
                  filteredArtifact.getGroupId() + ":" + filteredArtifact.getArtifactId()));
    }

    Artifact originatingArtifact =
        artifactFactory.createBuildArtifact("dummy", "dummy", "1.0", "jar");

    // DUNS, use access method rather than "localRepository" field.
    return artifactResolver.resolveTransitively(
        Collections.singleton(providerArtifact),
        originatingArtifact,
        getLocalRepository(),
        getRemoteRepositories(),
        metadataSource,
        filter);
  }