本文整理了Java中org.apache.maven.artifact.handler.manager.ArtifactHandlerManager
类的一些代码示例,展示了ArtifactHandlerManager
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArtifactHandlerManager
类的具体详情如下:
包路径:org.apache.maven.artifact.handler.manager.ArtifactHandlerManager
类名称:ArtifactHandlerManager
暂无
代码示例来源:origin: apache/maven
public ArtifactType get( String stereotypeId )
{
ArtifactHandler handler = handlerManager.getArtifactHandler( stereotypeId );
return newArtifactType( stereotypeId, handler );
}
代码示例来源:origin: org.jvnet.hudson.main/maven-plugin
/**
* Creates a Maven {@link Artifact} back from the persisted data.
*/
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;
}
代码示例来源:origin: org.apache.npanday.plugins/maven-vsinstaller-plugin
artifactHandlerManager.addHandlers( map );
代码示例来源:origin: jenkinsci/maven-plugin
/**
* Creates a Maven {@link Artifact} back from the persisted data.
*/
public CloseableArtifact toCloseableArtifact(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);
TemporaryFile file = getTemporaryFile(build);
a.setFile(file.getFile());
return new CloseableArtifact(a, file);
}
代码示例来源:origin: org.apache.maven/maven-project
public Artifact create( MavenProject project )
{
ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( project.getPackaging() );
return new DefaultArtifact( project.getGroupId(), project.getArtifactId(),
VersionRange.createFromVersion( project.getVersion() ), null,
project.getPackaging(), null, handler, false );
}
代码示例来源:origin: org.apache.maven/maven-project
public Artifact create( MavenProject project, String type, String classifier, boolean optional )
{
ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( type );
return new DefaultArtifact( project.getGroupId(), project.getArtifactId(),
VersionRange.createFromVersion( project.getVersion() ), null,
project.getPackaging(), null, handler, optional );
}
代码示例来源:origin: apache/maven
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
代码示例来源:origin: apache/maven
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
代码示例来源:origin: org.apache.maven/maven-project
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile )
{
String type = artifactType;
ArtifactHandler handler = null;
if ( type != null )
{
handler = artifactHandlerManager.getArtifactHandler( artifactType );
}
if ( handler == null )
{
handler = artifactHandlerManager.getArtifactHandler( "jar" );
}
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
project.addAttachedArtifact( artifact );
}
代码示例来源:origin: apache/maven
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier,
File artifactFile )
{
String type = artifactType;
ArtifactHandler handler = null;
if ( type != null )
{
handler = artifactHandlerManager.getArtifactHandler( artifactType );
}
if ( handler == null )
{
handler = artifactHandlerManager.getArtifactHandler( "jar" );
}
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
attachArtifact( project, artifact );
}
代码示例来源:origin: org.apache.maven/maven-project
public void attachArtifact( MavenProject project, String artifactType, File artifactFile )
{
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( artifactType );
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
project.addAttachedArtifact( artifact );
}
代码示例来源:origin: apache/maven
public void attachArtifact( MavenProject project, String artifactType, File artifactFile )
{
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( artifactType );
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
attachArtifact( project, artifact );
}
代码示例来源:origin: io.takari.maven.plugins/takari-lifecycle-plugin
public ArtifactType get(String stereotypeId) {
ArtifactHandler handler = handlerManager.getArtifactHandler(stereotypeId);
return newArtifactType(stereotypeId, handler);
}
}
代码示例来源:origin: takari/takari-lifecycle
public ArtifactType get(String stereotypeId) {
ArtifactHandler handler = handlerManager.getArtifactHandler(stereotypeId);
return newArtifactType(stereotypeId, handler);
}
}
代码示例来源:origin: org.apache.sling/maven-launchpad-plugin
private File getPrimaryArtifact() throws MojoExecutionException {
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(project.getPackaging());
String artifactName = project.getBuild().getFinalName() + "." + handler.getExtension();
File file = new File(buildDirectory, artifactName);
if (!file.exists()) {
throw new MojoExecutionException("Project's primary artifact (" + file.getPath() + ") doesn't exist.");
}
return file;
}
代码示例来源:origin: mojohaus/nbm-maven-plugin
Artifact createAttachedArtifact( Artifact primary, File file, String type, String classifier )
{
assert type != null;
ArtifactHandler handler;
handler = artifactHandlerManager.getArtifactHandler( type );
if ( handler == null )
{
getLog().warn( "No artifact handler for " + type );
handler = artifactHandlerManager.getArtifactHandler( "jar" );
}
Artifact artifact = new AttachedArtifact( primary, type, classifier, handler );
artifact.setFile( file );
artifact.setResolved( true );
return artifact;
}
代码示例来源:origin: net.flexmojos.oss/flexmojos-maven-plugin
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if("FlexJS".equals(compilerName)) {
Artifact artifact = project.getArtifact();
File flexjsOutputDirectory = artifact.getFile();
if((flexjsOutputDirectory == null) || !flexjsOutputDirectory.exists() ||
!flexjsOutputDirectory.isDirectory()) {
throw new MojoExecutionException("FlexJS compiler didn't create an output directory.");
}
final File targetFile = new File(
flexjsOutputDirectory.getParent(), flexjsOutputDirectory.getName() + ".zip");
try {
File sourceDir = new File(flexjsOutputDirectory,
debug ? "bin/js-debug" : "bin/js-release");
JarOutputStream jar = new JarOutputStream(new FileOutputStream(targetFile));
addFileToZip(jar, sourceDir, sourceDir);
jar.close();
ArtifactHandler handler = handlerManager.getArtifactHandler("zip");
artifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
artifact.getScope(), "zip", artifact.getClassifier(), handler);
artifact.setFile(targetFile);
project.setArtifact(artifact);
} catch (IOException e) {
throw new MojoExecutionException("Error zipping up result", e);
}
}
}
代码示例来源:origin: org.jetbrains.kotlin/kotlin-maven-plugin
@NotNull
private Artifact getArtifact(
@NotNull ArtifactHandlerManager artifactHandlerManager,
@NotNull DependencyCoordinate dependency) throws Exception {
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(dependency.getType());
return new DefaultArtifact(
dependency.getGroupId(),
dependency.getArtifactId(),
VersionRange.createFromVersionSpec(dependency.getVersion()),
Artifact.SCOPE_RUNTIME,
dependency.getType(),
dependency.getClassifier(),
handler,
false);
}
代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin
project.getArtifact().setArtifactHandler(artifactHandlerManager.getArtifactHandler("jar"));
代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin
project.getArtifact().setArtifactHandler(artifactHandlerManager.getArtifactHandler("jar"));
内容来源于网络,如有侵权,请联系作者删除!