org.apache.maven.artifact.handler.ArtifactHandler.isAddedToClasspath()方法的使用及代码示例

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

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

ArtifactHandler.isAddedToClasspath介绍

暂无

代码示例

代码示例来源: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: 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
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: 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: 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: org.apache.maven/maven-project

public List getTestClasspathElements()
  throws DependencyResolutionRequiredException
{
  List list = new ArrayList( getArtifacts().size() + 1 );
  list.add( getBuild().getTestOutputDirectory() );
  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
      // 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() ) )
      // {
      // }
      File file = a.getFile();
      if ( file == null )
      {
        throw new DependencyResolutionRequiredException( a );
      }
      list.add( file.getPath() );
    }
  }
  return list;
}

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

public List<String> getTestClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() + 2 );
  String d = getBuild().getTestOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  d = getBuild().getOutputDirectory();
  if ( d != null )
  {
    list.add( d );
  }
  for ( Artifact a : getArtifacts() )
  {
    if ( a.getArtifactHandler().isAddedToClasspath() )
    {
      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

@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

@Deprecated
public List<String> getSystemClasspathElements()
  throws DependencyResolutionRequiredException
{
  List<String> list = new ArrayList<>( getArtifacts().size() );
  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
      if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
      {
        addArtifactPath( a, list );
      }
    }
  }
  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: apache/maven

public List<String> getCompileClasspathElements()
  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
      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: apache/maven

public static ArtifactType newArtifactType( String id, ArtifactHandler handler )
{
  return new DefaultArtifactType( id, handler.getExtension(), handler.getClassifier(), handler.getLanguage(),
                  handler.isAddedToClasspath(), handler.isIncludesDependencies() );
}

代码示例来源:origin: electronicarts/ea-async

protected List<String> generateTestClasspath()
{
  List<String> classpath = new ArrayList<>(2 + project.getArtifacts().size());
  classpath.add(testClassesDirectory.getAbsolutePath());
  classpath.add(classesDirectory.getAbsolutePath());
  Set<Artifact> classpathArtifacts = project.getArtifacts();
  for (Artifact artifact : classpathArtifacts)
  {
    if (artifact.getArtifactHandler().isAddedToClasspath())
    {
      File file = artifact.getFile();
      if (file != null)
      {
        classpath.add(file.getPath());
      }
    }
  }
  return classpath;
}

代码示例来源:origin: electronicarts/ea-async

private List<String> generateClassPath()
{
  List<String> classpath = new ArrayList<>(2 + project.getArtifacts().size());
  classpath.add(classesDirectory.getAbsolutePath());
  Set<Artifact> classpathArtifacts = project.getArtifacts();
  for (Artifact artifact : classpathArtifacts)
  {
    if (artifact.getArtifactHandler().isAddedToClasspath()
        && !"test".equalsIgnoreCase(artifact.getScope()))
    {
      File file = artifact.getFile();
      if (file != null)
      {
        classpath.add(file.getPath());
      }
    }
  }
  return classpath;
}

代码示例来源:origin: gosu-lang/old-gosu-repo

protected List<File> getDependencies() {
 List<File> cp = Lists.newArrayList();
 for (Artifact art : mavenProject.getArtifacts()) {
  if (art.getArtifactHandler().isAddedToClasspath() && art.getFile() != null) {
   cp.add(art.getFile());
  }
 }
 return cp;
}

相关文章