in core-it-support/core-it-plugins/maven-it-plugin-artifact/src/main/java/org/apache/maven/plugin/coreit/ResolveMojo.java [92:135]
public void execute() throws MojoExecutionException {
getLog().info("[MAVEN-CORE-IT-LOG] Resolving artifacts");
Properties props = new Properties();
try {
if (dependencies != null) {
for (Dependency dependency : dependencies) {
Artifact artifact = factory.createArtifactWithClassifier(
dependency.getGroupId(),
dependency.getArtifactId(),
dependency.getVersion(),
dependency.getType(),
dependency.getClassifier());
getLog().info("[MAVEN-CORE-IT-LOG] Resolving " + getId(artifact));
resolver.resolve(artifact, remoteRepositories, localRepository);
if (artifact.getFile() != null) {
props.setProperty(getId(artifact), artifact.getFile().getPath());
}
getLog().info("[MAVEN-CORE-IT-LOG] " + artifact.getFile());
}
}
} catch (Exception e) {
throw new MojoExecutionException("Failed to resolve artifacts: " + e.getMessage(), e);
}
if (propertiesFile != null) {
getLog().info("[MAVEN-CORE-IT-LOG] Creating properties file " + propertiesFile);
try {
propertiesFile.getParentFile().mkdirs();
try (FileOutputStream fos = new FileOutputStream(propertiesFile)) {
props.store(fos, "MAVEN-CORE-IT");
}
} catch (IOException e) {
throw new MojoExecutionException("Failed to create properties file: " + e.getMessage(), e);
}
}
}