final Model model = xpp3Reader.read(reader);
// Make the deployer deploy the pom itself.
final DeployRequest artifactInstallRequest = new DeployRequest();
artifactInstallRequest.setRepository(remoteRepository);
Artifact pomArtifact = new DefaultArtifact(
model.getGroupId(), model.getArtifactId(), "pom", model.getVersion());
pomArtifact = pomArtifact.setFile(pomFile);
artifactInstallRequest.addArtifact(pomArtifact);
// Add any additional files to this installation.
final String artifactBaseName = model.getArtifactId() + "-" + model.getVersion();
final File artifactFiles[] = artifactDirectory.listFiles(new ArtifactFilter());
for (final File artifactFile : artifactFiles) {
final String fileName = artifactFile.getName();
// Handle the case that some file might not start with the base-name.
if(!fileName.startsWith(artifactBaseName)) {
continue;
}
final String classifier;
// This file has a classifier.
if (fileName.charAt(artifactBaseName.length()) == '-') {
classifier = fileName.substring(artifactBaseName.length() + 1,
fileName.indexOf(".", artifactBaseName.length()));
}
// This file doesn't have a classifier.
else {
classifier = "";
}
final String extension = fileName.substring(
artifactBaseName.length() + 1 + ((classifier.length() > 0) ? classifier.length() + 1 : 0));
Artifact fileArtifact = new DefaultArtifact(model.getGroupId(), model.getArtifactId(),
classifier, extension, model.getVersion());
fileArtifact = fileArtifact.setFile(artifactFile);
artifactInstallRequest.addArtifact(fileArtifact);
}
// Actually install the artifact.
System.out.println("Installing Artifact: " + pomArtifact.getGroupId() + ":" +