public String getProperty( String key, String defaultValue ) { return artifact.getProperty( key, defaultValue ); }
/** * Determines whether the specified artifact refers to test classes. * * @param artifact The artifact to check, must not be {@code null}. * @return {@code true} if the artifact refers to test classes, {@code false} otherwise. */ private static boolean isTestArtifact( Artifact artifact ) { return ( "test-jar".equals( artifact.getProperty( "type", "" ) ) ) || ( "jar".equals( artifact.getExtension() ) && "tests".equals( artifact.getClassifier() ) ); } }
public static ArtifactHandler newHandler( Artifact artifact ) { String type = artifact.getProperty( ArtifactProperties.TYPE, artifact.getExtension() ); DefaultArtifactHandler handler = new DefaultArtifactHandler( type ); handler.setExtension( artifact.getExtension() ); handler.setLanguage( artifact.getProperty( ArtifactProperties.LANGUAGE, null ) ); String addedToClasspath = artifact.getProperty( ArtifactProperties.CONSTITUTES_BUILD_PATH, "" ); handler.setAddedToClasspath( Boolean.parseBoolean( addedToClasspath ) ); String includesDependencies = artifact.getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" ); handler.setIncludesDependencies( Boolean.parseBoolean( includesDependencies ) ); return handler; }
String type = artifact.getProperty( "type", "" ); if ( project.hasLifecyclePhase( "compile" ) && COMPILE_PHASE_TYPES.contains( type ) )
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; }
public synchronized PluginDescriptor getPluginDescriptor( Plugin plugin, List<RemoteRepository> repositories, RepositorySystemSession session ) throws PluginResolutionException, PluginDescriptorParsingException, InvalidPluginDescriptorException { PluginDescriptorCache.Key cacheKey = pluginDescriptorCache.createKey( plugin, repositories, session ); PluginDescriptor pluginDescriptor = pluginDescriptorCache.get( cacheKey ); if ( pluginDescriptor == null ) { org.eclipse.aether.artifact.Artifact artifact = pluginDependenciesResolver.resolve( plugin, repositories, session ); Artifact pluginArtifact = RepositoryUtils.toArtifact( artifact ); pluginDescriptor = extractPluginDescriptor( pluginArtifact, plugin ); pluginDescriptor.setRequiredMavenVersion( artifact.getProperty( "requiredMavenVersion", null ) ); pluginDescriptorCache.put( cacheKey, pluginDescriptor ); } pluginDescriptor.setPlugin( plugin ); return pluginDescriptor; }
private static Metadata createRepositoryMetadata( Artifact artifact ) { Metadata metadata = new Metadata(); metadata.setGroupId( artifact.getGroupId() ); metadata.setArtifactId( artifact.getArtifactId() ); Versioning versioning = new Versioning(); versioning.addVersion( artifact.getBaseVersion() ); if ( !artifact.isSnapshot() ) { versioning.setRelease( artifact.getBaseVersion() ); } if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) ) { versioning.setLatest( artifact.getBaseVersion() ); } metadata.setVersioning( versioning ); return metadata; }
/** * Determines whether the specified artifact refers to test classes. * * @param artifact The artifact to check, must not be {@code null}. * @return {@code true} if the artifact refers to test classes, {@code false} otherwise. */ public static boolean isTestArtifact(Artifact artifact) { return ("test-jar".equals(artifact.getProperty("type", ""))) || ("jar".equals(artifact.getExtension()) && "tests".equals(artifact.getClassifier())); }
private static boolean isLackingDescriptor( Artifact artifact ) { return artifact.getProperty( ArtifactProperties.LOCAL_PATH, null ) != null; }
public String getProperty( String key, String defaultValue ) { return artifact.getProperty( key, defaultValue ); }
public String getProperty( String key, String defaultValue ) { return artifact.getProperty( key, defaultValue ); }
public String getProperty( String key, String defaultValue ) { return delegate.getProperty( key, defaultValue ); }
private static boolean isLackingDescriptor( Artifact artifact ) { return artifact.getProperty( ArtifactProperties.LOCAL_PATH, null ) != null; }
public boolean traverseDependency( Dependency dependency ) { String prop = dependency.getArtifact().getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" ); return !Boolean.parseBoolean( prop ); }
public boolean traverseDependency( Dependency dependency ) { String prop = dependency.getArtifact().getProperty( ArtifactProperties.INCLUDES_DEPENDENCIES, "" ); return !Boolean.parseBoolean( prop ); }
/** * Determines whether the specified artifact refers to test classes. * * @param artifact The artifact to check, must not be {@code null}. * @return {@code true} if the artifact refers to test classes, {@code false} otherwise. */ public static boolean isTestArtifact(Artifact artifact) { return ("test-jar".equals(artifact.getProperty("type", ""))) || ("jar".equals(artifact.getExtension()) && "tests".equals(artifact.getClassifier())); }
public static ArtifactHandler newHandler(Artifact artifact) { String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension()); DefaultArtifactHandler handler = new DefaultArtifactHandler(type); handler.setExtension(artifact.getExtension()); handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null)); handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, ""))); handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, ""))); return handler; }
public static ArtifactHandler newHandler(Artifact artifact) { String type = artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension()); DefaultArtifactHandler handler = new DefaultArtifactHandler(type); handler.setExtension(artifact.getExtension()); handler.setLanguage(artifact.getProperty(ArtifactProperties.LANGUAGE, null)); handler.setAddedToClasspath(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.CONSTITUTES_BUILD_PATH, ""))); handler.setIncludesDependencies(Boolean.parseBoolean(artifact.getProperty(ArtifactProperties.INCLUDES_DEPENDENCIES, ""))); return handler; }
protected MavenArtifactInfoImpl(final Artifact artifact, final ScopeType scopeType, final List<DependencyNode> children, boolean optional) { final PackagingType packaging = PackagingType.of(artifact.getProperty(ArtifactProperties.TYPE, artifact.getExtension())); final String classifier = artifact.getClassifier().length() == 0 ? packaging.getClassifier() : artifact.getClassifier(); this.mavenCoordinate = MavenCoordinates.createCoordinate(artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), packaging, classifier); this.resolvedVersion = artifact.getVersion(); this.snapshotVersion = artifact.isSnapshot(); this.extension = artifact.getExtension(); this.dependencies = parseDependencies(children); this.scopeType = scopeType; this.optional = optional; }
private Artifact getDependencyArtifact( Dependency dep ) { org.eclipse.aether.artifact.Artifact artifact = dep.getArtifact(); return factory.createDependencyArtifact( artifact.getGroupId(), artifact.getArtifactId(), VersionRange.createFromVersion( artifact.getVersion() ), artifact.getProperty( "type", artifact.getExtension() ), artifact.getClassifier(), dep.getScope(), dep.isOptional() ); }