本文整理了Java中org.apache.maven.artifact.Artifact.setFile()
方法的一些代码示例,展示了Artifact.setFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.setFile()
方法的具体详情如下:
包路径:org.apache.maven.artifact.Artifact
类名称:Artifact
方法名:setFile
暂无
代码示例来源:origin: org.apache.maven/maven-project
/** {@inheritDoc} */
public void setFile( File destination )
{
artifact.setFile( destination );
project.getArtifact().setFile( destination );
}
代码示例来源:origin: apache/maven
/** {@inheritDoc} */
public void setFile( File destination )
{
artifact.setFile( destination );
project.getArtifact().setFile( destination );
}
代码示例来源:origin: fabric8io/docker-maven-plugin
private void setArtifactFile(MavenProject project, File artifactFile) {
Artifact artifact = project.getArtifact();
if (artifact != null) {
artifact.setFile(artifactFile);
}
}
代码示例来源:origin: org.apache.maven/maven-project
public ActiveProjectArtifact( MavenProject project, Artifact artifact )
{
this.artifact = artifact;
this.project = project;
artifact.setFile( project.getArtifact().getFile() );
artifact.setResolved( true );
}
代码示例来源:origin: apache/maven
public ActiveProjectArtifact( MavenProject project, Artifact artifact )
{
this.artifact = artifact;
this.project = project;
artifact.setFile( project.getArtifact().getFile() );
artifact.setResolved( true );
}
代码示例来源:origin: spotify/dockerfile-maven
void attachJar(@Nonnull File jarFile) {
if (classifier != null) {
projectHelper.attachArtifact(project, "docker-info", classifier, jarFile);
} else {
project.getArtifact().setFile(jarFile);
}
}
代码示例来源:origin: apache/maven
public Artifact find( Artifact artifact )
{
File artifactFile = new File( getBasedir(), pathOf( artifact ) );
// We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
// with multiple local repository implementations yet.
artifact.setFile( artifactFile );
return artifact;
}
代码示例来源:origin: apache/maven
@Override
public Artifact find( Artifact artifact )
{
File artifactFile = new File( localRepository.getBasedir(), pathOf( artifact ) );
// We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
// with multiple local repository implementations yet.
artifact.setFile( artifactFile );
return artifact;
}
代码示例来源:origin: apache/maven
public Artifact find( Artifact artifact )
{
File artifactFile = new File( getBasedir(), pathOf( artifact ) );
// We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
// with multiple local repository implementations yet.
artifact.setFile( artifactFile );
if ( artifactFile.exists() )
{
artifact.setResolved( true );
}
return artifact;
}
代码示例来源: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 );
}
代码示例来源:origin: org.apache.maven/maven-project
public void attachArtifact( MavenProject project, String artifactType, File artifactFile )
{
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( artifactType );
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
project.addAttachedArtifact( artifact );
}
代码示例来源:origin: apache/maven
public void attachArtifact( MavenProject project, String artifactType, File artifactFile )
{
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( artifactType );
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
attachArtifact( project, artifact );
}
代码示例来源:origin: org.apache.maven/maven-project
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier, File artifactFile )
{
String type = artifactType;
ArtifactHandler handler = null;
if ( type != null )
{
handler = artifactHandlerManager.getArtifactHandler( artifactType );
}
if ( handler == null )
{
handler = artifactHandlerManager.getArtifactHandler( "jar" );
}
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
project.addAttachedArtifact( artifact );
}
代码示例来源:origin: apache/maven
public void attachArtifact( MavenProject project, String artifactType, String artifactClassifier,
File artifactFile )
{
String type = artifactType;
ArtifactHandler handler = null;
if ( type != null )
{
handler = artifactHandlerManager.getArtifactHandler( artifactType );
}
if ( handler == null )
{
handler = artifactHandlerManager.getArtifactHandler( "jar" );
}
Artifact artifact = new AttachedArtifact( project.getArtifact(), artifactType, artifactClassifier, handler );
artifact.setFile( artifactFile );
artifact.setResolved( true );
attachArtifact( project, artifact );
}
代码示例来源:origin: apache/maven
artifact.setFile( new File( d.getSystemPath() ) );
代码示例来源:origin: apache/maven
private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency,
String inheritedScope, ArtifactFilter inheritedFilter )
throws InvalidVersionSpecificationException
{
String effectiveScope = getEffectiveScope( dependency.getScope(), inheritedScope );
if ( effectiveScope == null )
{
return null;
}
VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
Artifact dependencyArtifact =
factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
dependency.getType(), dependency.getClassifier(), effectiveScope,
dependency.isOptional() );
ArtifactFilter dependencyFilter = inheritedFilter;
if ( dependencyFilter != null && !dependencyFilter.include( dependencyArtifact ) )
{
return null;
}
if ( Artifact.SCOPE_SYSTEM.equals( effectiveScope ) )
{
dependencyArtifact.setFile( new File( dependency.getSystemPath() ) );
}
dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, dependencyFilter ) );
return dependencyArtifact;
}
代码示例来源:origin: apache/maven
artifact.setFile( new File( d.getSystemPath() ) );
代码示例来源: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: apache/maven
public static org.apache.maven.artifact.Artifact toArtifact( Artifact artifact )
{
if ( artifact == null )
{
return null;
}
ArtifactHandler handler = newHandler( artifact );
/*
* NOTE: From Artifact.hasClassifier(), an empty string and a null both denote "no classifier". However, some
* plugins only check for null, so be sure to nullify an empty classifier.
*/
org.apache.maven.artifact.Artifact result =
new org.apache.maven.artifact.DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion(), null,
artifact.getProperty( ArtifactProperties.TYPE,
artifact.getExtension() ),
nullify( artifact.getClassifier() ), handler );
result.setFile( artifact.getFile() );
result.setResolved( artifact.getFile() != null );
List<String> trail = new ArrayList<>( 1 );
trail.add( result.getId() );
result.setDependencyTrail( trail );
return result;
}
内容来源于网络,如有侵权,请联系作者删除!