if (metadataMatcher.matches()) {
LOGGER.log(Level.INFO, String.format("Received upload request for maven metadata : %s", path));
try {
Metadata metadata = convertPathToMetadata(path);
metadata = metadata.setFile(file);
InstallRequest request = new InstallRequest();
request.addMetadata(metadata);
system.install(session, request);
LOGGER.log(Level.INFO, "Maven metadata installed: " + request.toString());
} catch (Exception e) {
result = UploadContext.ERROR;
LOGGER.log(Level.WARNING, String.format("Failed to upload metadata: %s due to %s", path, e), e);
}
//If no matching metadata found return nothing
} else if (artifactMatcher.matches()) {
LOGGER.log(Level.INFO, String.format("Received upload request for maven artifact : %s", path));
Artifact artifact = null;
try {
artifact = convertPathToArtifact(path);
artifact = artifact.setFile(file);
InstallRequest request = new InstallRequest();
request.addArtifact(artifact);
system.install(session, request);
result.setGroupId(artifact.getGroupId());
result.setArtifactId(artifact.getArtifactId());
result.setVersion(artifact.getVersion());