public ArtifactType get( String stereotypeId ) { ArtifactHandler handler = handlerManager.getArtifactHandler( stereotypeId ); return newArtifactType( stereotypeId, handler ); }
public Artifact create( MavenProject project ) { ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( project.getPackaging() ); return new DefaultArtifact( project.getGroupId(), project.getArtifactId(), VersionRange.createFromVersion( project.getVersion() ), null, project.getPackaging(), null, handler, false ); }
public Artifact create( MavenProject project, String type, String classifier, boolean optional ) { ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler( type ); return new DefaultArtifact( project.getGroupId(), project.getArtifactId(), VersionRange.createFromVersion( project.getVersion() ), null, project.getPackaging(), null, handler, optional ); }
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
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 ); }
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 ArtifactType get(String stereotypeId) { ArtifactHandler handler = handlerManager.getArtifactHandler(stereotypeId); return newArtifactType(stereotypeId, handler); } }
public ArtifactType get(String stereotypeId) { ArtifactHandler handler = handlerManager.getArtifactHandler(stereotypeId); return newArtifactType(stereotypeId, handler); } }
private File getPrimaryArtifact() throws MojoExecutionException { ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(project.getPackaging()); String artifactName = project.getBuild().getFinalName() + "." + handler.getExtension(); File file = new File(buildDirectory, artifactName); if (!file.exists()) { throw new MojoExecutionException("Project's primary artifact (" + file.getPath() + ") doesn't exist."); } return file; }
Artifact createAttachedArtifact( Artifact primary, File file, String type, String classifier ) { assert type != null; ArtifactHandler handler; handler = artifactHandlerManager.getArtifactHandler( type ); if ( handler == null ) { getLog().warn( "No artifact handler for " + type ); handler = artifactHandlerManager.getArtifactHandler( "jar" ); } Artifact artifact = new AttachedArtifact( primary, type, classifier, handler ); artifact.setFile( file ); artifact.setResolved( true ); return artifact; }
/** * Creates a Maven {@link Artifact} back from the persisted data. */ public Artifact toArtifact(ArtifactHandlerManager handlerManager, ArtifactFactory factory, MavenBuild build) throws IOException { // Hack: presence of custom ArtifactHandler during builds could influence the file extension // in the repository during deployment. So simulate that behavior if that's necessary. final String canonicalExtension = canonicalName.substring(canonicalName.lastIndexOf('.')+1); ArtifactHandler ah = handlerManager.getArtifactHandler(type); Map<String,ArtifactHandler> handlers = Maps.newHashMap(); handlers.put( type, new DefaultArtifactHandler(type) { public String getExtension() { return canonicalExtension; } } ); // Fix for HUDSON-3814 - changed from comparing against canonical extension to canonicalName.endsWith. if(!canonicalName.endsWith(ah.getExtension())) { handlerManager.addHandlers(handlers); } Artifact a = factory.createArtifactWithClassifier(groupId, artifactId, version, type, classifier); a.setFile(getFile(build)); return a; }
@NotNull private Artifact getArtifact( @NotNull ArtifactHandlerManager artifactHandlerManager, @NotNull DependencyCoordinate dependency) throws Exception { ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(dependency.getType()); return new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), VersionRange.createFromVersionSpec(dependency.getVersion()), Artifact.SCOPE_RUNTIME, dependency.getType(), dependency.getClassifier(), handler, false); }
private File getDependencyFile(ComponentDependency dep) { ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler(dep.getType()); Artifact artifact = new DefaultArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), null, dep.getType(), null, artifactHandler); return getArtifactFile(artifact); }
/** * @param dependency {@link Dependency} * @return {@link Artifact} * @throws MavenReportException when artifact could not be resolved */ public Artifact resolveDependency( Dependency dependency ) throws MavenReportException { DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate(); coordinate.setGroupId( dependency.getGroupId() ); coordinate.setArtifactId( dependency.getArtifactId() ); coordinate.setVersion( dependency.getVersion() ); coordinate.setClassifier( dependency.getClassifier() ); coordinate.setExtension( artifactHandlerManager.getArtifactHandler( dependency.getType() ).getExtension() ); try { return artifactResolver.resolveArtifact( session.getProjectBuildingRequest(), coordinate ).getArtifact(); } catch ( ArtifactResolverException e ) { throw new MavenReportException( "artifact resolver problem - " + e.getMessage(), e ); } }
@Override public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, DependableCoordinate root ) throws DependencyCollectorException { ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( root.getType() ); String extension = artifactHandler != null ? artifactHandler.getExtension() : null; Artifact aetherArtifact = new DefaultArtifact( root.getGroupId(), root.getArtifactId(), root.getClassifier(), extension, root.getVersion() ); CollectRequest request = new CollectRequest(); request.setRoot( new Dependency( aetherArtifact, null ) ); return collectDependencies( buildingRequest, request ); }
@Override public CollectorResult collectDependencies( ProjectBuildingRequest buildingRequest, DependableCoordinate root ) throws DependencyCollectorException { ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( root.getType() ); String extension = artifactHandler != null ? artifactHandler.getExtension() : null; Artifact aetherArtifact = new DefaultArtifact( root.getGroupId(), root.getArtifactId(), root.getClassifier(), extension, root.getVersion() ); CollectRequest request = new CollectRequest(); request.setRoot( new Dependency( aetherArtifact, null ) ); return collectDependencies( buildingRequest, request ); }
private ArtifactCoordinate toArtifactCoordinate( DependableCoordinate dependableCoordinate ) { ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( dependableCoordinate.getType() ); DefaultArtifactCoordinate artifactCoordinate = new DefaultArtifactCoordinate(); artifactCoordinate.setGroupId( dependableCoordinate.getGroupId() ); artifactCoordinate.setArtifactId( dependableCoordinate.getArtifactId() ); artifactCoordinate.setVersion( dependableCoordinate.getVersion() ); artifactCoordinate.setClassifier( dependableCoordinate.getClassifier() ); artifactCoordinate.setExtension( artifactHandler.getExtension() ); return artifactCoordinate; }