本文整理了Java中org.apache.maven.artifact.Artifact.getType()
方法的一些代码示例,展示了Artifact.getType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.getType()
方法的具体详情如下:
包路径:org.apache.maven.artifact.Artifact
类名称:Artifact
方法名:getType
暂无
代码示例来源:origin: simpligility/android-maven-plugin
private boolean matchesTarget( Artifact found )
{
return found.getGroupId().equals( target.getGroupId() )
&& found.getArtifactId().equals( target.getArtifactId() )
&& found.getVersion().equals( target.getVersion() )
&& found.getType().equals( target.getType() )
&& classifierMatch( found.getClassifier(), target.getClassifier() )
;
}
代码示例来源:origin: apache/maven
File getTouchfile( Artifact artifact )
{
StringBuilder sb = new StringBuilder( 128 );
sb.append( artifact.getArtifactId() );
sb.append( '-' ).append( artifact.getBaseVersion() );
if ( artifact.getClassifier() != null )
{
sb.append( '-' ).append( artifact.getClassifier() );
}
sb.append( '.' ).append( artifact.getType() ).append( LAST_UPDATE_TAG );
return new File( artifact.getFile().getParentFile(), sb.toString() );
}
代码示例来源:origin: apache/maven
private ModelSource createStubModelSource( Artifact artifact )
{
StringBuilder buffer = new StringBuilder( 1024 );
buffer.append( "<?xml version='1.0'?>" );
buffer.append( "<project>" );
buffer.append( "<modelVersion>4.0.0</modelVersion>" );
buffer.append( "<groupId>" ).append( artifact.getGroupId() ).append( "</groupId>" );
buffer.append( "<artifactId>" ).append( artifact.getArtifactId() ).append( "</artifactId>" );
buffer.append( "<version>" ).append( artifact.getBaseVersion() ).append( "</version>" );
buffer.append( "<packaging>" ).append( artifact.getType() ).append( "</packaging>" );
buffer.append( "</project>" );
return new StringModelSource( buffer, artifact.getId() );
}
代码示例来源:origin: simpligility/android-maven-plugin
/**
* Generate correct R.java for apklibs dependencies of a current project
*
* @throws MojoExecutionException
*/
private void generateCorrectRJavaForApklibDependencies( ResourceClassGenerator resourceGenerator )
throws MojoExecutionException
{
getLog().debug( "" );
getLog().debug( "#generateCorrectRJavaFoApklibDeps" );
// Generate R.java for apklibs
// Compatibility with Apklib which isn't present in AndroidBuilder
getLog().debug( "Generating Rs for apklib deps of project " + project.getArtifact() );
final Set<Artifact> apklibDependencies = getTransitiveDependencyArtifacts( APKLIB );
for ( final Artifact artifact : apklibDependencies )
{
getLog().debug( "Generating apklib R.java for " + artifact.getArtifactId() + "..." );
generateRForApkLibDependency( artifact );
}
// Generate corrected R.java for APKLIB dependencies, but only if this is an APK build.
if ( !apklibDependencies.isEmpty() && APK.equals( project.getArtifact().getType() ) )
{
// Generate R.java for each APKLIB based on R.txt
getLog().debug( "" );
getLog().debug( "Rewriting R files for APKLIB dependencies : " + apklibDependencies );
resourceGenerator.generateLibraryRs( apklibDependencies );
}
}
代码示例来源:origin: org.apache.maven/maven-artifact
protected AbstractArtifactResolutionException( String message,
Artifact artifact,
List<ArtifactRepository> remoteRepositories,
Throwable t )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
artifact.getClassifier(), remoteRepositories, artifact.getDependencyTrail(), t );
this.artifact = artifact;
}
代码示例来源:origin: simpligility/android-maven-plugin
final String type = artifact.getType();
if ( type.equals( APKLIB ) && !instrumentationTest )
getLog().info( "Extracting apklib " + artifact.getArtifactId() + "..." );
extractApklib( artifact );
getLog().info( "Extracting aar " + artifact.getArtifactId() + "..." );
extractAarLib( artifact );
getLog().info( "Extracting apk " + artifact.getArtifactId() + "..." );
extractApkClassesJar( artifact );
代码示例来源:origin: apache/maven
protected AbstractArtifactResolutionException( String message,
Artifact artifact,
List<ArtifactRepository> remoteRepositories,
Throwable t )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
artifact.getClassifier(), remoteRepositories, artifact.getDependencyTrail(), t );
this.artifact = artifact;
}
代码示例来源:origin: simpligility/android-maven-plugin
artifactSet.getExcludes() ) )
if ( artifact.getType().equals( Const.ArtifactType.NATIVE_SYMBOL_OBJECT )
|| artifact.getType().equals( Const.ArtifactType.NATIVE_IMPLEMENTATION_ARCHIVE ) )
else if ( artifact.getType().equals( APKLIB ) )
else if ( artifact.getType().equals( AAR ) )
else if ( artifact.getType().equals( APK ) )
getLog().debug( "Extracting APK classes to target/classes : " + artifact.getArtifactId() );
final File apkClassesJar = getUnpackedLibHelper().getJarFileForApk( artifact );
getLog().debug( "Extracting APK : " + apkClassesJar + " to " + targetDirectory );
代码示例来源:origin: apache/maven
public ArtifactNotFoundException( String message, Artifact artifact )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() );
}
代码示例来源:origin: apache/maven
protected ArtifactNotFoundException( String message, Artifact artifact,
List<ArtifactRepository> remoteRepositories, Throwable cause )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(),
cause );
}
代码示例来源:origin: org.apache.maven/maven-artifact
public ArtifactNotFoundException( String message, Artifact artifact )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
artifact.getClassifier(), null, artifact.getDownloadUrl(), artifact.getDependencyTrail() );
}
代码示例来源:origin: org.apache.maven/maven-artifact
protected ArtifactNotFoundException( String message, Artifact artifact,
List<ArtifactRepository> remoteRepositories, Throwable cause )
{
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(),
artifact.getClassifier(), remoteRepositories, artifact.getDownloadUrl(), artifact.getDependencyTrail(),
cause );
}
代码示例来源:origin: org.apache.maven/maven-artifact
if ( !a.getGroupId().equals( groupId ) )
else if ( !a.getArtifactId().equals( artifactId ) )
else if ( !a.getType().equals( type ) )
代码示例来源:origin: org.apache.maven/maven-project
public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler )
{
super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
classifier, artifactHandler, parent.isOptional() );
setDependencyTrail( Collections.singletonList( parent.getId() ) );
this.parent = parent;
if ( getId().equals( parent.getId() ) )
{
throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), parent.getType(), "An attached artifact must have a different ID than its corresponding main artifact." );
}
}
代码示例来源:origin: apache/maven
if ( !a.getGroupId().equals( groupId ) )
else if ( !a.getArtifactId().equals( artifactId ) )
else if ( !a.getType().equals( type ) )
代码示例来源:origin: apache/maven
private static int artifactHashCode( Artifact a )
{
int result = 17;
result = 31 * result + a.getGroupId().hashCode();
result = 31 * result + a.getArtifactId().hashCode();
result = 31 * result + a.getType().hashCode();
if ( a.getVersion() != null )
{
result = 31 * result + a.getVersion().hashCode();
}
result = 31 * result + ( a.getClassifier() != null ? a.getClassifier().hashCode() : 0 );
result = 31 * result + ( a.getScope() != null ? a.getScope().hashCode() : 0 );
result = 31 * result + ( a.getDependencyFilter() != null ? a.getDependencyFilter().hashCode() : 0 );
result = 31 * result + ( a.isOptional() ? 1 : 0 );
return result;
}
代码示例来源:origin: org.apache.maven/maven-project
/**
* 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();
}
代码示例来源:origin: org.apache.maven/maven-artifact
private static String constructMessage( List<Artifact> artifacts )
{
StringBuilder buffer = new StringBuilder( 256 );
buffer.append( "Missing:\n" );
buffer.append( "----------\n" );
int counter = 0;
for ( Artifact artifact : artifacts )
{
String message = ( ++counter ) + ") " + artifact.getId();
buffer.append( constructMissingArtifactMessage( message, " ", artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(),
artifact.getDownloadUrl(), artifact.getDependencyTrail() ) );
}
buffer.append( "----------\n" );
int size = artifacts.size();
buffer.append( size ).append( " required artifact" );
if ( size > 1 )
{
buffer.append( "s are" );
}
else
{
buffer.append( " is" );
}
buffer.append( " missing.\n\nfor artifact: " );
return buffer.toString();
}
代码示例来源:origin: apache/maven
private static String constructMessage( List<Artifact> artifacts )
{
StringBuilder buffer = new StringBuilder( 256 );
buffer.append( "Missing:\n" );
buffer.append( "----------\n" );
int counter = 0;
for ( Artifact artifact : artifacts )
{
String message = ( ++counter ) + ") " + artifact.getId();
buffer.append( constructMissingArtifactMessage( message, " ", artifact.getGroupId(),
artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), artifact.getClassifier(),
artifact.getDownloadUrl(), artifact.getDependencyTrail() ) );
}
buffer.append( "----------\n" );
int size = artifacts.size();
buffer.append( size ).append( " required artifact" );
if ( size > 1 )
{
buffer.append( "s are" );
}
else
{
buffer.append( " is" );
}
buffer.append( " missing.\n\nfor artifact: " );
return buffer.toString();
}
代码示例来源:origin: apache/maven
public AttachedArtifact( Artifact parent, String type, String classifier, ArtifactHandler artifactHandler )
{
super( parent.getGroupId(), parent.getArtifactId(), parent.getVersionRange(), parent.getScope(), type,
classifier, artifactHandler, parent.isOptional() );
setDependencyTrail( Collections.singletonList( parent.getId() ) );
this.parent = parent;
if ( getId().equals( parent.getId() ) )
{
throw new InvalidArtifactRTException( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(),
parent.getType(), "An attached artifact must have a different ID"
+ " than its corresponding main artifact." );
}
}
内容来源于网络,如有侵权,请联系作者删除!