org.apache.maven.artifact.Artifact.getArtifactHandler()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(148)

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

Artifact.getArtifactHandler介绍

暂无

代码示例

代码示例来源:origin: org.apache.maven/maven-project

/** {@inheritDoc} */
public ArtifactHandler getArtifactHandler()
{
  return artifact.getArtifactHandler();
}

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

/** {@inheritDoc} */
public ArtifactHandler getArtifactHandler()
{
  return artifact.getArtifactHandler();
}

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

@Deprecated
public List<Artifact> getTestArtifacts()
{
  List<Artifact> list = new ArrayList<>( getArtifacts().size() );
  for ( Artifact a : getArtifacts() )
  {
    // TODO classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      list.add( a );
    }
  }
  return list;
}

代码示例来源:origin: org.apache.maven/maven-project

public List getTestArtifacts()
{
  List list = new ArrayList( getArtifacts().size() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    // TODO: classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      // NOTE: [jc] scope == 'test' is the widest possible scope, so we don't really need to perform
      // this check...
      // if ( Artifact.SCOPE_TEST.equals( a.getScope() ) || Artifact.SCOPE_COMPILE.equals( a.getScope() ) ||
      //      Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
      // {
      //     list.add( a );
      // }
      list.add( a );
    }
  }
  return list;
}

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

/** @deprecated we want to use the artifact method only, and ensure artifact.file is set correctly. */
@Deprecated
public void install( String basedir, String finalName, Artifact artifact, ArtifactRepository localRepository )
  throws ArtifactInstallationException
{
  String extension = artifact.getArtifactHandler().getExtension();
  File source = new File( basedir, finalName + "." + extension );
  install( source, artifact, localRepository );
}

代码示例来源:origin: org.apache.maven/maven-project

public List getSystemArtifacts()
{
  List list = new ArrayList( getArtifacts().size() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    // TODO: classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        list.add( a );
      }
    }
  }
  return list;
}

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

/**
 * @deprecated we want to use the artifact method only, and ensure artifact.file is set
 *             correctly.
 */
@Deprecated
public void deploy( String basedir, String finalName, Artifact artifact, ArtifactRepository deploymentRepository,
          ArtifactRepository localRepository )
  throws ArtifactDeploymentException
{
  String extension = artifact.getArtifactHandler().getExtension();
  File source = new File( basedir, finalName + "." + extension );
  deploy( source, artifact, deploymentRepository, localRepository );
}

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

@Deprecated
public List<Artifact> getSystemArtifacts()
{
  List<Artifact> list = new ArrayList<>( getArtifacts().size() );
  for ( Artifact a : getArtifacts() )
  {
    // TODO classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO let the scope handler deal with this
      if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        list.add( a );
      }
    }
  }
  return list;
}

代码示例来源:origin: org.apache.maven/maven-project

public List getRuntimeArtifacts()
{
  List list = new ArrayList( getArtifacts().size() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    // TODO: classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
      {
        list.add( a );
      }
    }
  }
  return list;
}

代码示例来源:origin: org.apache.maven/maven-project

public List getSystemClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() );
  list.add( getBuild().getOutputDirectory() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  return list;
}

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

@Deprecated
public List<Artifact> getRuntimeArtifacts()
{
  List<Artifact> list = new ArrayList<>( getArtifacts().size() );
  for ( Artifact a : getArtifacts()  )
  {
    // TODO classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath()
    // TODO let the scope handler deal with this
      && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
    {
      list.add( a );
    }
  }
  return list;
}

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

public String pathOf( Artifact artifact )
{
  ArtifactHandler artifactHandler = artifact.getArtifactHandler();
  StringBuilder path = new StringBuilder( 128 );
  path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
  if ( artifact.hasClassifier() )
  {
    path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
  }
  if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
  {
    path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
  }
  return path.toString();
}

代码示例来源:origin: org.apache.maven/maven-project

public List getCompileArtifacts()
{
  List list = new ArrayList( getArtifacts().size() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    // TODO: classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) ||
        Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        list.add( a );
      }
    }
  }
  return list;
}

代码示例来源:origin: org.apache.maven/maven-project

public List getCompileClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() );
  list.add( getBuild().getOutputDirectory() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) ||
        Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  return list;
}

代码示例来源:origin: org.apache.maven/maven-project

public List getRuntimeClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() + 1 );
  list.add( getBuild().getOutputDirectory() );
  for ( Iterator i = getArtifacts().iterator(); i.hasNext(); )
  {
    Artifact a = (Artifact) i.next();
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO: let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) )
      {
        File file = a.getFile();
        if ( file == null )
        {
          throw new DependencyResolutionRequiredException( a );
        }
        list.add( file.getPath() );
      }
    }
  }
  return list;
}

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

public String pathOf( Artifact artifact )
{
  ArtifactHandler artifactHandler = artifact.getArtifactHandler();
  StringBuilder path = new StringBuilder( 128 );
  path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR );
  path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR );
  path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR );
  path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
  if ( artifact.hasClassifier() )
  {
    path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() );
  }
  if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 )
  {
    path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() );
  }
  return path.toString();
}

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

@Deprecated
public List<Artifact> getCompileArtifacts()
{
  List<Artifact> list = new ArrayList<>( getArtifacts().size() );
  for ( Artifact a : getArtifacts() )
  {
    // TODO classpath check doesn't belong here - that's the other method
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      // TODO let the scope handler deal with this
      if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() )
        || Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        list.add( a );
      }
    }
  }
  return list;
}

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

public List<String> getRuntimeClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() + 1 );
  String d = getBuild().getOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  for ( Artifact a : getArtifacts() )
  {
    if ( a.getArtifactHandler().isAddedToClasspath()
    // TODO let the scope handler deal with this
      && ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) )
    {
      addArtifactPath( a, list );
    }
  }
  return list;
}

代码示例来源:origin: org.apache.maven/maven-project

public void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier )
{
  Artifact projectArtifact = project.getArtifact();
  
  Artifact artifact = new AttachedArtifact( projectArtifact, projectArtifact.getType(), artifactClassifier, projectArtifact.getArtifactHandler() );
  
  artifact.setFile( artifactFile );
  artifact.setResolved( true );
  
  project.addAttachedArtifact( artifact );
}

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

public void attachArtifact( MavenProject project, File artifactFile, String artifactClassifier )
{
  Artifact projectArtifact = project.getArtifact();
  Artifact artifact =
    new AttachedArtifact( projectArtifact, projectArtifact.getType(), artifactClassifier,
               projectArtifact.getArtifactHandler() );
  artifact.setFile( artifactFile );
  artifact.setResolved( true );
  attachArtifact( project, artifact );
}

相关文章

微信公众号

最新文章

更多