List of usage examples for org.apache.maven.artifact.repository.metadata MetadataBridge MetadataBridge
public MetadataBridge(ArtifactMetadata metadata)
From source file:net.oneandone.maven.embedded.Maven.java
License:Apache License
/** * You'll usually pass one jar artifact and the corresponding pom artifact. * @param pluginName null if you deploy normal artifacts; none-null for Maven Plugins, that you wish to add a plugin mapping for; * specifies the plugin name in this case. * See http://svn.apache.org/viewvc/maven/plugin-tools/tags/maven-plugin-tools-3.2/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java?revision=1406624&view=markup *//*from w w w. j a va2 s . co m*/ // CHECKSTYLE:ON public void deploy(RemoteRepository target, String pluginName, List<Artifact> artifacts) throws DeploymentException { DeployRequest request; GroupRepositoryMetadata gm; String prefix; request = new DeployRequest(); for (Artifact artifact : artifacts) { if (artifact.getFile() == null) { throw new IllegalArgumentException(artifact.toString() + " without file"); } request.addArtifact(artifact); if (pluginName != null) { gm = new GroupRepositoryMetadata(artifact.getGroupId()); prefix = getGoalPrefixFromArtifactId(artifact.getArtifactId()); gm.addPluginMapping(prefix, artifact.getArtifactId(), pluginName); request.addMetadata(new MetadataBridge(gm)); } } request.setRepository(target); repositorySystem.deploy(repositorySession, request); }