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

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

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

Artifact.setScope介绍

暂无

代码示例

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

/** {@inheritDoc} */
public void setScope( String scope )
{
  artifact.setScope( scope );
}

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

/** {@inheritDoc} */
public void setScope( String scope )
{
  artifact.setScope( scope );
}

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

resultArtifact.setScope( pluginArtifact.getScope() );
return resultArtifact;

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

private static org.apache.maven.artifact.Artifact toArtifact( Dependency dependency )
{
  if ( dependency == null )
  {
    return null;
  }
  org.apache.maven.artifact.Artifact result = toArtifact( dependency.getArtifact() );
  result.setScope( dependency.getScope() );
  result.setOptional( dependency.isOptional() );
  return result;
}

代码示例来源:origin: jeremylong/DependencyCheck

/**
 * Converts the dependency into a dependency node
 *
 * @param buildingRequest the Maven building request
 * @param parent the parent node
 * @param dependency the dependency to convert
 * @return the resulting dependency node
 * @throws ArtifactResolverException thrown if there is an error during
 * conversion
 */
private DependencyNode toDependencyNode(ProjectBuildingRequest buildingRequest, DependencyNode parent,
    org.apache.maven.model.Dependency dependency) throws ArtifactResolverException {
  final DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate();
  coordinate.setGroupId(dependency.getGroupId());
  coordinate.setArtifactId(dependency.getArtifactId());
  coordinate.setVersion(dependency.getVersion());
  coordinate.setExtension(dependency.getType());
  coordinate.setClassifier(dependency.getClassifier());
  final Artifact artifact = artifactResolver.resolveArtifact(buildingRequest, coordinate).getArtifact();
  artifact.setScope(dependency.getScope());
  return new DefaultDependencyNode(parent, artifact, dependency.getVersion(), dependency.getScope(), null);
}

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

nearestArtifact.setScope( farthestArtifact.getScope() );

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

result.setFile( artifact.getFile() );
result.setScope( artifact.getScope() );
result.setArtifactHandler( artifact.getArtifactHandler() );
result.setDependencyFilter( artifact.getDependencyFilter() );

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

private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions,
               List<ResolutionListener> listeners )
{
  Artifact artifact = managedVersions.get( node.getKey() );
  // Before we update the version of the artifact, we need to know
  // whether we are working on a transitive dependency or not. This
  // allows depMgmt to always override transitive dependencies, while
  // explicit child override depMgmt (viz. depMgmt should only
  // provide defaults to children, but should override transitives).
  // We can do this by calling isChildOfRootNode on the current node.
  if ( ( artifact.getVersion() != null )
       && ( !node.isChildOfRootNode() || node.getArtifact().getVersion() == null ) )
  {
    fireEvent( ResolutionListener.MANAGE_ARTIFACT_VERSION, listeners, node, artifact );
    node.getArtifact().setVersion( artifact.getVersion() );
  }
  if ( ( artifact.getScope() != null ) && ( !node.isChildOfRootNode() || node.getArtifact().getScope() == null ) )
  {
    fireEvent( ResolutionListener.MANAGE_ARTIFACT_SCOPE, listeners, node, artifact );
    node.getArtifact().setScope( artifact.getScope() );
  }
  if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) && ( node.getArtifact().getFile() == null )
       && ( artifact.getFile() != null ) )
  {
    fireEvent( ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH, listeners, node, artifact );
    node.getArtifact().setFile( artifact.getFile() );
  }
}

代码示例来源:origin: org.apache.maven.plugins/maven-gpg-plugin

public void setScope( String scope )
{
  delegate.setScope( scope );
}

代码示例来源:origin: torquebox/jruby-maven-plugins

public void setScope(final String scope) {
  this.artifact.setScope(scope);
}

代码示例来源:origin: bsorrentino/maven-confluence-plugin

@Override
public void updateScope( Artifact artifact, String scope )
{
  Node node = (Node) artifacts.get( artifact.getDependencyConflictId() );
  node.artifact.setScope( scope );
}

代码示例来源:origin: org.apache.geronimo.genesis.plugins/plugin-support

public void updateScope(final Artifact artifact, final String scope) {
  Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
  node.artifact.setScope(scope);
}

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

public void updateScope(final Artifact artifact, final String scope) {
  Node node = (Node) artifacts.get(artifact.getDependencyConflictId());
  node.artifact.setScope(scope);
}

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

public void manageArtifact(final Artifact artifact, final Artifact replacement) {
    Node node = (Node) artifacts.get(artifact.getDependencyConflictId());

    if (node != null) {
      if (replacement.getVersion() != null) {
        node.artifact.setVersion(replacement.getVersion());
      }
      if (replacement.getScope() != null) {
        node.artifact.setScope(replacement.getScope());
      }
    }
  }
}

代码示例来源:origin: org.apache.geronimo.genesis.plugins/plugin-support

public void manageArtifact(final Artifact artifact, final Artifact replacement) {
    Node node = (Node) artifacts.get(artifact.getDependencyConflictId());

    if (node != null) {
      if (replacement.getVersion() != null) {
        node.artifact.setVersion(replacement.getVersion());
      }
      if (replacement.getScope() != null) {
        node.artifact.setScope(replacement.getScope());
      }
    }
  }
}

代码示例来源:origin: chrisdchristo/capsule-maven-plugin

private Artifact toArtifact(final Dependency dependency) {
  if (dependency == null) return null;
  final Artifact artifact = toArtifact(resolve(dependency));
  artifact.setScope(dependency.getScope());
  if (artifact.getScope() == null || artifact.getScope().isEmpty()) artifact.setScope("compile");
  return artifact;
}

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

private Collection<Artifact> calcDependencies(Artifact artifact) {
  artifact.setScope(null);
  final ArtifactResolutionResult res = mavenContext.resolveArtifact(artifact, parameters);
  res.getArtifacts().removeIf(a -> a.equals(artifact) || !parameters.include(a) || a.getDependencyTrail().size() != 2);
  if (res.getArtifacts().isEmpty() && !res.getMissingArtifacts().isEmpty()) {
    return null;
  }
  return res.getArtifacts();
}

代码示例来源:origin: org.apache.maven.shared/maven-dependency-tree

private Artifact getDependencyArtifact( Dependency dep )
{
  Artifact mavenArtifact = RepositoryUtils.toArtifact( dep.getArtifact() );
  mavenArtifact.setScope( dep.getScope() );
  mavenArtifact.setOptional( dep.isOptional() );
  return mavenArtifact;
}

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

private static org.apache.maven.artifact.Artifact toArtifact(Dependency dependency) {
 if (dependency == null) {
  return null;
 }
 org.apache.maven.artifact.Artifact result = toArtifact(dependency.getArtifact());
 result.setScope(dependency.getScope());
 result.setOptional(dependency.isOptional());
 return result;
}

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

private static org.apache.maven.artifact.Artifact toArtifact(Dependency dependency) {
 if (dependency == null) {
  return null;
 }
 org.apache.maven.artifact.Artifact result = toArtifact(dependency.getArtifact());
 result.setScope(dependency.getScope());
 result.setOptional(dependency.isOptional());
 return result;
}

相关文章

微信公众号

最新文章

更多