private void setArtifactFile(MavenProject project, File artifactFile) { Artifact artifact = project.getArtifact(); if (artifact != null) { artifact.setFile(artifactFile); } }
public ActiveProjectArtifact( MavenProject project, Artifact artifact ) { this.artifact = artifact; this.project = project; artifact.setFile( project.getArtifact().getFile() ); artifact.setResolved( true ); }
public ActiveProjectArtifact( MavenProject project, Artifact artifact ) { this.artifact = artifact; this.project = project; artifact.setFile( project.getArtifact().getFile() ); artifact.setResolved( true ); }
void attachJar(@Nonnull File jarFile) { if (classifier != null) { projectHelper.attachArtifact(project, "docker-info", classifier, jarFile); } else { project.getArtifact().setFile(jarFile); } }
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; }
@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; }
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; }
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 ); }
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 ); }
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 ); }
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 ); }
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 ); }
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 ); }
artifact.setFile( new File( d.getSystemPath() ) );
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; }
artifact.setFile( new File( d.getSystemPath() ) );
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() ); } }
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; }