org.apache.maven.artifact.handler.DefaultArtifactHandler.<init>()方法的使用及代码示例

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

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

DefaultArtifactHandler.<init>介绍

暂无

代码示例

代码示例来源: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: 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: 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: 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: 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: 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: 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: 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.uberfire/uberfire-maven-integration

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

代码示例来源: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: com.itemis.maven.plugins/unleash-maven-plugin

@Override
 public org.apache.maven.artifact.Artifact apply(org.eclipse.aether.artifact.Artifact a) {
  return new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), "compile", a.getExtension(),
    a.getClassifier() != null ? a.getClassifier() : null, new DefaultArtifactHandler());
 }
}

代码示例来源:origin: shillner/unleash-maven-plugin

@Override
 public org.apache.maven.artifact.Artifact apply(org.eclipse.aether.artifact.Artifact a) {
  return new DefaultArtifact(a.getGroupId(), a.getArtifactId(), a.getVersion(), "compile", a.getExtension(),
    a.getClassifier() != null ? a.getClassifier() : null, new DefaultArtifactHandler());
 }
}

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

private static Artifact createMockArtifact( final String groupId, final String artifactId,
                        final String versionRange, final String scope, final String type,
                        final String classifier )
  {
    ArtifactHandler artifactHandler = new DefaultArtifactHandler();

    VersionRange version = VersionRange.createFromVersion( versionRange );
    return new DefaultArtifact( groupId, artifactId, version, scope, type, classifier, artifactHandler );
  }
}

代码示例来源: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: 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: guru.nidi/build-tools

public static ArtifactResolutionResult resolveArtifact(MavenSession session, RepositorySystem repository, Artifact artifact, boolean transitive, ArtifactFilter resolutionFilter) {
  artifact.setArtifactHandler(new DefaultArtifactHandler(artifact.getType()));
  ArtifactResolutionRequest request = new ArtifactResolutionRequest()
      .setArtifact(artifact)
      .setResolveRoot(true)
      .setServers(session.getRequest().getServers())
      .setMirrors(session.getRequest().getMirrors())
      .setProxies(session.getRequest().getProxies())
      .setLocalRepository(session.getLocalRepository())
      .setRemoteRepositories(session.getRequest().getRemoteRepositories())
      .setResolveTransitively(transitive)
      .setCollectionFilter(resolutionFilter)
      .setResolutionFilter(resolutionFilter);
  //.setListeners(Arrays.<ResolutionListener>asList(new DebugResolutionListener(new ConsoleLogger())));
  return repository.resolve(request);
}

相关文章