2
Maven 및 Jcabi-Aether를 사용하여 일부 아티팩트를 가져 오거나 해결하려고합니다. 나는 준비가 대부분의 코드 있다고 생각하지만 난 힘든 시간 오드 사용할 수 있도록 내가 remotes
변수로 메이븐 저장소를로드 할 수 있도록 사용자의 settings.xml
을로드하는 방법을 알아내는 있습니다Jcabi-Aether를 사용할 Maven의 settings.xml을로드하십시오.
import com.jcabi.aether.Aether;
import java.io.File;
import java.util.Arrays;
import org.apache.maven.project.MavenProject;
import org.sonatype.aether.artifact.Artifact;
import org.sonatype.aether.repository.RemoteRepository;
import org.sonatype.aether.util.artifact.DefaultArtifact;
public class Main {
public static void main(String[] args) {
File local = new File("/tmp/local-repository");
Collection<RemoteRepository> remotes = Arrays.asList(
new RemoteRepository(
"maven-central",
"default",
"http://repo1.maven.org/maven2/"
)
);
Collection<Artifact> deps = new Aether(remotes, local).resolve(
new DefaultArtifact("junit", "junit-dep", "", "jar", "4.10"),
"runtime"
);
}
}
로드 할 가능을 settings.xml
및 리포지토리 정보를 얻으시겠습니까?