Refine search
public static Artifact toArtifact( org.apache.maven.artifact.Artifact artifact ) { if ( artifact == null ) { return null; } String version = artifact.getVersion(); if ( version == null && artifact.getVersionRange() != null ) { version = artifact.getVersionRange().toString(); } Map<String, String> props = null; if ( org.apache.maven.artifact.Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) ) { String localPath = ( artifact.getFile() != null ) ? artifact.getFile().getPath() : ""; props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, localPath ); } Artifact result = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getArtifactHandler().getExtension(), version, props, newArtifactType( artifact.getType(), artifact.getArtifactHandler() ) ); result = result.setFile( artifact.getFile() ); return result; }
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; }
public static ArtifactType newArtifactType( String id, ArtifactHandler handler ) { return new DefaultArtifactType( id, handler.getExtension(), handler.getClassifier(), handler.getLanguage(), handler.isAddedToClasspath(), handler.isIncludesDependencies() ); }
Artifact artifact = project.getArtifact(); String projectPackaging = project.getPackaging(); artifact.setFile( project.getFile() ); ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, project.getFile() ); artifact.addMetadata( metadata ); String finalName = project.getBuild().getFinalName(); String filename = finalName + "." + artifact.getArtifactHandler().getExtension(); String buildDirectory = project.getBuild().getDirectory();
} else { for (MavenProject p : reactorProjects) { if (p.getPackaging().equals("gwt-app")) { projectList.add(p); ambiguousProjectIds.add(key); key = p.getGroupId() + key; if (projectMap.put(key, p) != null) { projectMap.remove(key); cp.add(p.getBuild().getOutputDirectory()); for (Artifact artifact : p.getArtifacts()) { if (!artifact.getArtifactHandler().isAddedToClasspath()) { continue; if ("gwt-lib".equals(artifact.getArtifactHandler().getPackaging())) { MavenProject reference = getReferencedProject(p, artifact); if (reference != null && reference.getArtifact() != null && reference.getArtifact().getFile() != null) { artifact = reference.getArtifact(); FileUtils.forceMkdir(new File(project.getBuild().getDirectory())); FileUtils.forceMkdir(getWorkDir()); forceMkdirs();
/** * Converts the filename of an artifact to artifactId-version.type format. * * @param artifact * @return converted filename of the artifact */ private String getDefaultFinalName(Artifact artifact) { return artifact.getArtifactId() + "-" + artifact.getVersion() + "." + artifact.getArtifactHandler().getExtension(); }
signer.setBuildDirectory( new File( project.getBuild().getDirectory() ) ); signer.setBaseDirectory( project.getBasedir() ); if ( !"pom".equals( project.getPackaging() ) ) Artifact artifact = project.getArtifact(); File file = artifact.getFile(); signingBundles.add( new SigningBundle( artifact.getArtifactHandler().getExtension(), projectArtifactSignature ) ); File pomToSign = new File( project.getBuild().getDirectory(), project.getBuild().getFinalName() + ".pom" ); File file = artifact.getFile(); signingBundles.add( new SigningBundle( artifact.getArtifactHandler().getExtension(), artifact.getClassifier(), signature ) );
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; }
items.add( new File( project.getBuild().getOutputDirectory() ) ); addSources( items, project.getCompileSourceRoots() ); if ( isGenerator ) { addResources( items, project.getResources() ); addSources( items, project.getTestCompileSourceRoots() ); addResources( items, project.getTestResources() ); items.add( new File( project.getBuild().getTestOutputDirectory() ) ); items.add( artifact.getFile() ); for ( Artifact artifact : artifacts ) String artifactScope = artifact.getScope(); if ( SCOPE_COMPILE.equals( artifactScope ) || SCOPE_PROVIDED.equals( artifactScope ) || SCOPE_SYSTEM.equals( artifactScope ) ) items.add( artifact.getFile() ); if ( !artifact.getScope().equals( SCOPE_TEST ) && artifact.getArtifactHandler().isAddedToClasspath() ) items.add( artifact.getFile() );
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; }
public String pathOf( Artifact artifact ) { ArtifactHandler artifactHandler = artifact.getArtifactHandler(); StringBuilder path = new StringBuilder( 128 ); path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR ); path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR ); path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR ); path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() ); if ( artifact.hasClassifier() ) { path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() ); } if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) { path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() ); } return path.toString(); }
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; }
/** * Gets the repository conflict id of the specified artifact. Unlike the dependency conflict id, the repository * conflict id uses the artifact file extension instead of the artifact type. Hence, the repository conflict id more * closely reflects the identity of artifacts as perceived by a repository. * * @param artifact The artifact, must not be <code>null</code>. * @return The repository conflict id, never <code>null</code>. */ private String getRepositoryConflictId( Artifact artifact ) { StringBuffer buffer = new StringBuffer( 128 ); buffer.append( artifact.getGroupId() ); buffer.append( ':' ).append( artifact.getArtifactId() ); if ( artifact.getArtifactHandler() != null ) { buffer.append( ':' ).append( artifact.getArtifactHandler().getExtension() ); } else { buffer.append( ':' ).append( artifact.getType() ); } if ( artifact.hasClassifier() ) { buffer.append( ':' ).append( artifact.getClassifier() ); } return buffer.toString(); }
private File shadedSourcesArtifactFile() { Artifact artifact = project.getArtifact(); String shadedName; if ( project.getBuild().getFinalName() != null ) { shadedName = project.getBuild().getFinalName() + "-sources." + artifact.getArtifactHandler().getExtension(); } else { shadedName = shadedArtifactId + "-" + artifact.getVersion() + "-sources." + artifact.getArtifactHandler().getExtension(); } return new File( outputDirectory, shadedName ); }
private static void putArtifact(MutableWorkspaceState state, Artifact artifact) { state.putArtifact(artifact.getFile(), artifact.getGroupId(), artifact.getArtifactId(), // artifact.getArtifactHandler().getExtension(), artifact.getClassifier(), artifact.getBaseVersion()); }
new ArtifactSelector( project.getArtifact(), artifactSet, shadedGroupFilter ); if ( artifactSelector.isSelected( project.getArtifact() ) && !"pom".equals( project.getArtifact().getType() ) ) artifacts.add( project.getArtifact().getFile() ); && !finalName.equals( project.getBuild().getFinalName() ) ) String finalFileName = finalName + "." + project.getArtifact().getArtifactHandler().getExtension(); File finalFile = new File( outputDirectory, finalFileName ); replaceFile( finalFile, outputJar );
ArtifactHandler artifactHandler = getProject().getArtifact().getArtifactHandler(); if ( !"java".equals( artifactHandler.getLanguage() ) ) new File( getProject().getBuild().getDirectory(), "generated-classes/cobertura" ); File outputDirectory = new File( getProject().getBuild().getOutputDirectory() ); if ( !outputDirectory.exists() ) getProject().getBuild().setOutputDirectory( instrumentedDirectory.getPath() ); System.setProperty( "project.build.outputDirectory", instrumentedDirectory.getPath() ); attachCoberturaArtifactIfAppropriate();
if ( artifact.getFile() != null && !removeVersion ) destFileName = artifact.getFile().getName(); if ( !removeVersion ) versionString = "-" + artifact.getVersion(); destFileName = artifact.getArtifactId() + versionString + classifierString + "." + artifact.getArtifactHandler().getExtension();
public String pathOf( Artifact artifact ) { ArtifactHandler artifactHandler = artifact.getArtifactHandler(); StringBuilder path = new StringBuilder( 128 ); path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() ); if ( artifact.hasClassifier() ) { path.append( ARTIFACT_SEPARATOR ).append( artifact.getClassifier() ); } if ( artifactHandler.getExtension() != null && artifactHandler.getExtension().length() > 0 ) { path.append( GROUP_SEPARATOR ).append( artifactHandler.getExtension() ); } return path.toString(); }
public static String getProjectArtifactCoordinates(MavenProject project, String versionOverride) { org.apache.maven.artifact.Artifact artifact = project.getArtifact(); String extension = artifact.getArtifactHandler().getExtension(); String version = versionOverride == null ? project.getVersion() : versionOverride; if (artifact.hasClassifier()) { return project.getGroupId() + ":" + project.getArtifactId() + ":" + extension + ":" + artifact.getClassifier() + ":" + version; } else { return project.getGroupId() + ":" + project.getArtifactId() + ":" + extension + ":" + version; } }