org.apache.maven.artifact.Artifact.getArtifactId()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中org.apache.maven.artifact.Artifact.getArtifactId()方法的一些代码示例,展示了Artifact.getArtifactId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Artifact.getArtifactId()方法的具体详情如下:
包路径:org.apache.maven.artifact.Artifact
类名称:Artifact
方法名:getArtifactId

Artifact.getArtifactId介绍

暂无

代码示例

代码示例来源:origin: org.apache.maven/maven-project

public Object getKey()
{
  return "project " + artifact.getGroupId() + ":" + artifact.getArtifactId();
}

代码示例来源:origin: org.apache.maven/maven-project

public String toString()
{
  return "project information for " + artifact.getArtifactId() + " " + artifact.getVersion();
}

代码示例来源:origin: org.apache.maven/maven-project

private String getRelocationKey( Artifact artifact )
{
  return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
}

代码示例来源: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: simpligility/android-maven-plugin

private void copyNativeLibraryArtifact( Artifact artifact,
                    File destinationDirectory,
                    String ndkArchitecture ) throws MojoExecutionException
{
  final File artifactFile = getArtifactResolverHelper().resolveArtifactToFile( artifact );
  try
  {
    final String artifactId = artifact.getArtifactId();
    String filename = artifactId.startsWith( "lib" )
        ? artifactId + ".so"
        : "lib" + artifactId + ".so";
    if ( ndkFinalLibraryName != null
        && artifact.getFile().getName().startsWith( "lib" + ndkFinalLibraryName ) )
    {
      // The artifact looks like one we built with the NDK in this module
      // preserve the name from the NDK build
      filename = artifact.getFile().getName();
    }
    final File folder = new File( destinationDirectory, ndkArchitecture );
    final File file = new File( folder, filename );
    getLog().debug( "Copying native dependency " + artifactId + " (" + artifact.getGroupId() + ") to " + file );
    FileUtils.copyFile( artifactFile, file );
  }
  catch ( IOException e )
  {
    throw new MojoExecutionException( "Could not copy native dependency.", e );
  }
}

代码示例来源:origin: simpligility/android-maven-plugin

for ( Artifact artifact : pluginDependencies )
  getLog().debug( "pluginArtifact: " + artifact.getFile() );
  if ( ( "proguard".equals( artifact.getArtifactId() ) ) || ( "proguard-base"
    .equals( artifact.getArtifactId() ) ) )
  getLog().debug( "proguardArtifact: " + proguardArtifact.getFile() );
  return proguardArtifact.getFile().getAbsoluteFile().toString();

代码示例来源:origin: apache/usergrid

Artifact artifact = ( Artifact ) it.next();
File f = artifact.getFile();
  throw new MojoExecutionException( "Cannot locate artifact file of " + artifact.getArtifactId() );
      FileUtils.getFileNames( targetFolderFile, artifact.getArtifactId() + "-*.jar", null, false );
        existing.get( 0 ).split( "(" + artifact.getArtifactId() + "-)" )[1].split( "(.jar)" )[0];
    DefaultArtifactVersion existingVersion = new DefaultArtifactVersion( version );
    DefaultArtifactVersion artifactVersion = new DefaultArtifactVersion( artifact.getVersion() );
      LOG.info( "Artifact " + artifact.getArtifactId() + " with the same or higher " +
          "version already exists in lib folder, skipping copy" );
      continue;
  throw new MojoExecutionException( "Error while copying artifact file of " + artifact.getArtifactId(),
      e );

代码示例来源: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 ) )
  getLog().debug( "Extracting APK classes to target/classes : " + artifact.getArtifactId() );
  final File apkClassesJar = getUnpackedLibHelper().getJarFileForApk( artifact );
  getLog().debug( "Extracting APK : " + apkClassesJar + " to " + targetDirectory );
  getLog().debug( "Adding dex input : " + artifact.getFile() );
  inputs.add( artifact.getFile().getAbsoluteFile() );

代码示例来源:origin: org.apache.maven.plugin-testing/maven-plugin-testing-harness

if ( artifact.getFile() != null && !removeVersion )
  destFileName = artifact.getFile().getName();
  if ( !removeVersion )
    versionString = "-" + artifact.getVersion();
  if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
    classifierString = "-" + artifact.getClassifier();
  destFileName = artifact.getArtifactId() + versionString + classifierString + "."
    + artifact.getArtifactHandler().getExtension();

代码示例来源: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: apache/maven

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();
}

代码示例来源: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 );
  getLog().debug( "Not extracting " + artifact.getArtifactId() + "..." );

代码示例来源: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: konsoletyper/teavm

private String[] createDaemonClassPath() {
  Artifact toolArtifact = pluginArtifacts.stream()
      .filter(artifact -> artifact.getGroupId().equals("org.teavm")
          && artifact.getArtifactId().equals("teavm-tooling"))
      .findFirst()
      .orElse(null);
  if (toolArtifact == null) {
    return new String[0];
  }
  ArtifactResolutionResult resolutionResult = repositorySystem.resolve(new ArtifactResolutionRequest()
      .setLocalRepository(localRepository)
      .setRemoteRepositories(new ArrayList<>(remoteRepositories))
      .setResolveTransitively(true)
      .setResolveRoot(true)
      .setArtifact(toolArtifact));
  if (!resolutionResult.isSuccess()) {
    return new String[0];
  }
  return resolutionResult.getArtifacts().stream()
      .map(artifact -> artifact.getFile().getAbsolutePath())
      .toArray(String[]::new);
}

代码示例来源:origin: org.apache.maven/maven-artifact

public static String key( Artifact artifact )
{
  return key( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
}

代码示例来源:origin: apache/maven

public Object getKey()
{
  return "artifact " + artifact.getGroupId() + ":" + artifact.getArtifactId();
}

代码示例来源:origin: simpligility/android-maven-plugin

if ( artifact.getArtifactId().equals( "android" ) && parsedIncludeJdkLibs )
      createProguardInput( artifact.getFile().getAbsolutePath(), ANDROID_LIBRARY_EXCLUDED_FILTER )
  );
  libraryJars.add( createProguardInput( artifact.getFile().getAbsolutePath() ) );
  libraryJars.add( createProguardInput( artifact.getFile().getAbsolutePath() ) );

代码示例来源:origin: org.scala-tools/maven-scala-plugin

protected List<List<String>> makeDependencies(ScalaGenJsonMojo data) throws Exception {
 List<List<String>> back = new ArrayList<List<String>>();
 @SuppressWarnings("unchecked")
 List<Artifact> deps = data.project.getCompileArtifacts();
 for (Artifact dep : deps) {
  List<String> e = new ArrayList<String>(3);
  e.add(dep.getFile().getCanonicalPath());
  e.add(dep.getArtifactId() + "/" + dep.getVersion());
  back.add(e);
 }
 return back;
}

代码示例来源:origin: testIT-LivingDoc/livingdoc-core

private URL getDependencyURL(String name) throws MojoExecutionException {
  if (pluginDependencies != null && ! pluginDependencies.isEmpty()) {
    for (Iterator<Artifact> it = pluginDependencies.iterator(); it.hasNext();) {
      Artifact artifact = it.next();
      if (artifact.getArtifactId().equals(name) && artifact.getType().equals("jar")) {
        return toURL(artifact.getFile());
      }
    }
  }
  throw new MojoExecutionException("Dependency not found: " + name);
}

代码示例来源:origin: simpligility/android-maven-plugin

getLog().debug( "Generating incomplete R file for apklib: " + apklibArtifact.getGroupId()
    + ":" + apklibArtifact.getArtifactId() );
final File apklibManifest = new File( unpackDir, "AndroidManifest.xml" );
final File apklibResDir = new File( unpackDir, "res" );
  final String extension = dependency.getType();
  final File dependencyResDir = getUnpackedLibResourceFolder( dependency );
  if ( ( extension.equals( APKLIB ) || extension.equals( AAR ) ) && dependencyResDir.exists() )
  final String extension = dependency.getType();
  final File dependencyAssetsDir = getUnpackedLibAssetsFolder( dependency );
  if ( ( extension.equals( APKLIB ) || extension.equals( AAR ) ) )

相关文章

微信公众号

最新文章

更多