org.apache.maven.artifact.handler.DefaultArtifactHandler类的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.apache.maven.artifact.handler.DefaultArtifactHandler类的一些代码示例,展示了DefaultArtifactHandler类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DefaultArtifactHandler类的具体详情如下:
包路径:org.apache.maven.artifact.handler.DefaultArtifactHandler
类名称:DefaultArtifactHandler

DefaultArtifactHandler介绍

暂无

代码示例

代码示例来源:origin: apache/maven

public ArtifactHandler getArtifactHandler( String type )
{
  ArtifactHandler handler = unmanagedHandlers.get( type );
  if ( handler == null )
  {
    handler = artifactHandlers.get( type );
    if ( handler == null )
    {
      handler = new DefaultArtifactHandler( type );
    }
  }
  return handler;
}

代码示例来源:origin: apache/maven

public static ArtifactHandler newHandler( Artifact artifact )
{
  String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() );
  DefaultArtifactHandler handler = new DefaultArtifactHandler( type );
  handler.setExtension( artifact.getExtension() );
  handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) );
  String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" );
  handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) );
  String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" );
  handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) );
  return handler;
}

代码示例来源:origin: org.kie.soup/kie-soup-maven-integration

private ArtifactHandler buildArtifactHandler(String type) {
  DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( type );
  artifactHandler.setLanguage( "java" );
  artifactHandler.setAddedToClasspath( true );
  return artifactHandler;
}

代码示例来源:origin: org.mule.tools.maven/mule-packager

/**
 * Build the default artifact file name in a maven repository.
 *
 * @param artifact the artifact from which the default file name is going to be resolved.
 * @return the default artifact file name that a repository resource contains given its type.
 */
public static String getFormattedFileName(Artifact artifact) {
 String destFileName = buildMainFileName(artifact);
 String extension = new DefaultArtifactHandler(artifact.getType()).getExtension();
 return destFileName + "." + extension;
}

代码示例来源:origin: org.uberfire/uberfire-maven-integration

private ArtifactHandler buildArtifactHandler(String type) {
  DefaultArtifactHandler artifactHandler = new DefaultArtifactHandler( type );
  artifactHandler.setLanguage( "java" );
  artifactHandler.setAddedToClasspath( true );
  return artifactHandler;
}

代码示例来源:origin: fabric8io/docker-maven-plugin

private Artifact getArtifactFromPomProperties(String type, Properties pomProps) {
  return new DefaultArtifact(
      pomProps.getProperty("groupId"),
      pomProps.getProperty("artifactId"),
      pomProps.getProperty("version"),
      "runtime",
      type,
      pomProps.getProperty("classifier", ""),
      new DefaultArtifactHandler(type)
  );
}

代码示例来源:origin: takari/takari-lifecycle

public static ArtifactHandler newHandler(Artifact artifact) {
 String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension());
 DefaultArtifactHandler handler = new DefaultArtifactHandler(type);
 handler.setExtension(artifact.getExtension());
 handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null));
 handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, "")));
 handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, "")));
 return handler;
}

代码示例来源:origin: com.marvelution.maven/maven-test-utils

/**
 * Gets the ArtifactHandler for the given type
 * 
 * @param type the type of the artifact
 * @return the {@link ArtifactHandler}
 */
public ArtifactHandler getArtifactHandler(String type) {
  return new DefaultArtifactHandler(type);
}

代码示例来源:origin: io.takari.maven.plugins/takari-lifecycle-plugin

public static ArtifactHandler newHandler(Artifact artifact) {
 String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension());
 DefaultArtifactHandler handler = new DefaultArtifactHandler(type);
 handler.setExtension(artifact.getExtension());
 handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null));
 handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, "")));
 handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, "")));
 return handler;
}

代码示例来源:origin: org.jolokia/docker-maven-plugin

private Artifact getArtifactFromPomProperties(String type, Properties pomProps) {
  return new DefaultArtifact(
      pomProps.getProperty("groupId"),
      pomProps.getProperty("artifactId"),
      pomProps.getProperty("version"),
      "runtime",
      type,
      pomProps.getProperty("classifier", ""),
      new DefaultArtifactHandler(type)
  );
}

代码示例来源:origin: com.marvelution.maven/maven-test-utils

/**
 * {@inheritDoc}
 */
public ArtifactHandler getArtifactHandler() {
  if (handler == null) {
    handler = new DefaultArtifactHandler(getType());
  }
  return handler;
}

代码示例来源:origin: guru.nidi/build-tools

public static Artifact resolveArtifactFile(MavenSession session, RepositorySystem repository, String groupId, String artifactId, String version, String type) {
  final DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, version, "compile", type, "", new DefaultArtifactHandler(type));
  final ArtifactResolutionResult result = resolveArtifact(session, repository, artifact, false, null);
  for (Artifact a : result.getArtifacts()) {
    if (a.equals(artifact)) {
      return a;
    }
  }
  throw new IllegalArgumentException(artifact + " could not be resolved");
}

代码示例来源:origin: org.kie.workbench.services/kie-wb-common-compiler-core

private static void createArtifacts(List<Dependency> pomDeps,
                  Set<Artifact> deps) {
  if (pomDeps != null && pomDeps.size() > 0) {
    for (Dependency dep : pomDeps) {
      Artifact artifact = new DefaultArtifact(dep.getGroupId(),
                          dep.getArtifactId(),
                          dep.getVersion(),
                          dep.getScope(),
                          dep.getType(),
                          dep.getClassifier(),
                          new DefaultArtifactHandler());
      deps.add(artifact);
    }
  }
}

代码示例来源:origin: reactiverse/vertx-maven-plugin

private void attachIfNeeded(File jar) {
  if (jar.isFile() && classifier != null && attach) {
    ArtifactHandler handler = new DefaultArtifactHandler("jar");
    Artifact vertxJarArtifact = new DefaultArtifact(project.getGroupId(),
      project.getArtifactId(), project.getVersion(), "compile",
      "jar", classifier, handler);
    vertxJarArtifact.setFile(jar);
    this.project.addAttachedArtifact(vertxJarArtifact);
  }
}

代码示例来源:origin: mojohaus/versions-maven-plugin

private ArtifactVersion[] filterVersionsWithIncludes( ArtifactVersion[] newer, Artifact artifact )
{
  List<ArtifactVersion> filteredNewer = new ArrayList<>( newer.length );
  for ( int j = 0; j < newer.length; j++ )
  {
    ArtifactVersion artifactVersion = newer[j];
    Artifact artefactWithNewVersion =
      new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                 VersionRange.createFromVersion( artifactVersion.toString() ), artifact.getScope(),
                 artifact.getType(), null, new DefaultArtifactHandler(), false );
    if ( isIncluded( artefactWithNewVersion ) )
    {
      filteredNewer.add( artifactVersion );
    }
  }
  return filteredNewer.toArray( new ArtifactVersion[filteredNewer.size()] );
}

代码示例来源:origin: org.codehaus.mojo/versions-maven-plugin

private ArtifactVersion[] filterVersionsWithIncludes( ArtifactVersion[] newer, Artifact artifact )
{
  List<ArtifactVersion> filteredNewer = new ArrayList<>( newer.length );
  for ( int j = 0; j < newer.length; j++ )
  {
    ArtifactVersion artifactVersion = newer[j];
    Artifact artefactWithNewVersion =
      new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                 VersionRange.createFromVersion( artifactVersion.toString() ), artifact.getScope(),
                 artifact.getType(), null, new DefaultArtifactHandler(), false );
    if ( isIncluded( artefactWithNewVersion ) )
    {
      filteredNewer.add( artifactVersion );
    }
  }
  return filteredNewer.toArray( new ArtifactVersion[filteredNewer.size()] );
}

代码示例来源:origin: de.smartics.util/smartics-maven-utils

/**
 * Builds an instance of {@link Artifact}.
 *
 * @return the created instance.
 */
public Artifact build()
{
 if (artifactHandler == null)
 {
  withArtifactHandler(new DefaultArtifactHandler());
 }
 return new DefaultArtifact(groupId, artifactId, versionRange, scope, type,
   classifier, artifactHandler);
}

代码示例来源:origin: stackoverflow.com

ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
configuration.setProcessPlugins( false );
configuration.setRepositorySession( session );
org.apache.maven.artifact.Artifact artifact = new org.apache.maven.artifact.DefaultArtifact(groupId, artifactId, version, "compile", "", "", new DefaultArtifactHandler());
MavenProject project = projectBuilder.build(artifact, configuration).getProject();

代码示例来源:origin: locationtech/geowave

"type",
    null,
    new DefaultArtifactHandler());
a.setFile(cassandraDir);
f.set(this, a);

代码示例来源:origin: zolyfarkas/spf4j

mavenProject.getArtifactId(), mavenProject.getVersion(), "compile",
    schemaArtifactExtension, schemaArtifactClassifier,
    new DefaultArtifactHandler(schemaArtifactExtension));
schemas.setFile(avsc.toFile());
logger.debug("Attaching " + schemas  + " from " + avsc);
    new DefaultArtifactHandler("jar"));
avroSources.setFile(sources.toFile());
mavenProject.getAttachedArtifacts().add(avroSources);

相关文章