List of usage examples for org.apache.maven.artifact.handler.manager ArtifactHandlerManager addHandlers
@Deprecated
void addHandlers(Map<String, ArtifactHandler> handlers);
From source file:hudson.gridmaven.reporters.MavenArtifact.java
License:Open Source License
/** * Creates a Maven {@link Artifact} back from the persisted data. *//*from w ww .jav a 2 s .co m*/ public Artifact toArtifact(ArtifactHandlerManager handlerManager, ArtifactFactory factory, MavenBuild build) throws IOException { // Hack: presence of custom ArtifactHandler during builds could influence the file extension // in the repository during deployment. So simulate that behavior if that's necessary. final String canonicalExtension = canonicalName.substring(canonicalName.lastIndexOf('.') + 1); ArtifactHandler ah = handlerManager.getArtifactHandler(type); Map<String, ArtifactHandler> handlers = Maps.newHashMap(); handlers.put(type, new DefaultArtifactHandler(type) { public String getExtension() { return canonicalExtension; } }); // Fix for HUDSON-3814 - changed from comparing against canonical extension to canonicalName.endsWith. if (!canonicalName.endsWith(ah.getExtension())) { handlerManager.addHandlers(handlers); } Artifact a = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier); a.setFile(getFile(build)); return a; }