当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactMetadata类代码示例

本文整理汇总了Java中org.apache.maven.artifact.metadata.ArtifactMetadata的典型用法代码示例。如果您正苦于以下问题:Java ArtifactMetadata类的具体用法?Java ArtifactMetadata怎么用?Java ArtifactMetadata使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArtifactMetadata类属于org.apache.maven.artifact.metadata包,在下文中一共展示了ArtifactMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: pathOfRepositoryMetadata

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
private String pathOfRepositoryMetadata( ArtifactMetadata metadata,
                                         String filename )
{
    StringBuilder path = new StringBuilder( 128 );

    path.append( formatAsDirectory( metadata.getGroupId() ) ).append( PATH_SEPARATOR );
    if ( !metadata.storedInGroupDirectory() )
    {
        path.append( metadata.getArtifactId() ).append( PATH_SEPARATOR );

        if ( metadata.storedInArtifactVersionDirectory() )
        {
            path.append( metadata.getBaseVersion() ).append( PATH_SEPARATOR );
        }
    }

    path.append( filename );

    return path.toString();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultRepositoryLayout.java

示例2: addMetadata

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
public void addMetadata( ArtifactMetadata metadata )
{
    if ( metadataMap == null )
    {
        metadataMap = new HashMap<Object, ArtifactMetadata>();
    }

    ArtifactMetadata m = metadataMap.get( metadata.getKey() );
    if ( m != null )
    {
        m.merge( metadata );
    }
    else
    {
        metadataMap.put( metadata.getKey(), metadata );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:DefaultArtifact.java

示例3: installChecksums

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
/**
 * Installs the checksums for the specified artifact if this has been enabled in the plugin configuration. This
 * method creates checksums for files that have already been installed to the local repo to account for on-the-fly
 * generated/updated files. For example, in Maven 2.0.4- the <code>ProjectArtifactMetadata</code> did not install
 * the original POM file (cf. MNG-2820). While the plugin currently requires Maven 2.0.6, we continue to hash the
 * installed POM for robustness with regard to future changes like re-introducing some kind of POM filtering.
 *
 * @param artifact The artifact for which to create checksums, must not be <code>null</code>.
 * @param metadataFiles The set where additional metadata files will be registered for later checksum installation,
 *            must not be <code>null</code>.
 * @throws MojoExecutionException If the checksums could not be installed.
 */
protected void installChecksums( Artifact artifact, Collection metadataFiles )
        throws MojoExecutionException
{
    if ( !createChecksum )
    {
        return;
    }

    File artifactFile = getLocalRepoFile( artifact );
    installChecksums( artifactFile );

    Collection metadatas = artifact.getMetadataList();
    if ( metadatas != null )
    {
        for ( Iterator it = metadatas.iterator(); it.hasNext(); )
        {
            ArtifactMetadata metadata = (ArtifactMetadata) it.next();
            File metadataFile = getLocalRepoFile( metadata );
            metadataFiles.add( metadataFile );
        }
    }
}
 
开发者ID:agaricusb,项目名称:SpecialSourceMP,代码行数:35,代码来源:InstallRemappedFileMojo.java

示例4: testV3PomConvertWithRelocation

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Test
public void testV3PomConvertWithRelocation()
    throws Exception
{
    Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    artifactMetadataFile.delete();

    ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    File versionMetadataFile = new File( targetRepository.getBasedir(),
                                         targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
    versionMetadataFile.delete();

    artifactConverter.convert( artifact, targetRepository );
    //checkSuccess();  --> commented until MNG-2100 is fixed

    File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    assertTrue( "Check if relocated artifact created", artifactFile.exists() );
    assertTrue( "Check if relocated artifact matches",
                FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
    Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
    File pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
    File testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) );
    compareFiles( pomFile, testFile );

    Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
    artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
    assertTrue( "Check if relocation artifact pom is created", artifactFile.exists() );
    testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
    compareFiles( artifactFile, testFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java

示例5: testV3PomWarningsOnConvert

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Test
public void testV3PomWarningsOnConvert()
    throws Exception
{
    // test that the pom is converted but that warnings are reported

    Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    artifactMetadataFile.delete();

    ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    File versionMetadataFile = new File( targetRepository.getBasedir(),
                                         targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
    versionMetadataFile.delete();

    artifactConverter.convert( artifact, targetRepository );
    checkWarnings( artifactConverter, 2 );

    File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    assertTrue( "Check artifact created", artifactFile.exists() );
    assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );

    artifact = createPomArtifact( artifact );
    File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
    assertTrue( "Check POM created", pomFile.exists() );

    compareFiles( expectedPomFile, pomFile );

    // TODO: check 2 warnings (extend and versions) matched on i18n key
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java

示例6: testMergeArtifactMetadata

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Test
public void testMergeArtifactMetadata()
    throws Exception
{
    // test artifact level metadata is merged when it already exists on successful conversion

    Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" );
    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    assertTrue( "Check artifact created", artifactFile.exists() );
    assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );

    artifact = createPomArtifact( artifact );
    File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
    assertTrue( "Check POM created", pomFile.exists() );

    compareFiles( sourcePomFile, pomFile );

    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    File artifactMetadataFile = new File( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() );

    File expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );
}
 
开发者ID:ruikom,项目名称:apache-archiva,代码行数:31,代码来源:LegacyToDefaultConverterTest.java

示例7: installArtifact

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
/**
 * Installs a passed artifact into the local repository.
 */
protected void installArtifact(@Nonnull Artifact artifact, @Nonnull Path modelPath, @Nonnull Path artifactPath) throws ArtifactInstallationException {
    this.getLog().debug("Installing artifact " + this.getArtifactCoordinateString(artifact));

    ArtifactMetadata metadata = new ProjectArtifactMetadata(artifact, modelPath.toFile());
    artifact.addMetadata(metadata);

    this.getArtifactInstaller().install(artifactPath.toFile(), artifact, this.getSession().getLocalRepository());
}
 
开发者ID:BasinMC,项目名称:minecraft-maven-plugin,代码行数:12,代码来源:AbstractArtifactMojo.java

示例8: getArtifactMetadataFromDeploymentRepository

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Override
public void getArtifactMetadataFromDeploymentRepository(ArtifactMetadata metadata,
                                                        ArtifactRepository repository,
                                                        File destination,
                                                        String checksumPolicy) throws TransferFailedException,
                                                                                      ResourceDoesNotExistException {
  // todo use cache here
  super.getArtifactMetadataFromDeploymentRepository(metadata, repository, destination, checksumPolicy);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CustomMaven3WagonManager.java

示例9: testV3PomConvertWithRelocation

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Test
public void testV3PomConvertWithRelocation()
    throws Exception
{
    Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    Files.deleteIfExists(artifactMetadataFile);

    ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
                                         targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
    Files.deleteIfExists(versionMetadataFile);

    artifactConverter.convert( artifact, targetRepository );
    //checkSuccess();  --> commented until MNG-2100 is fixed

    Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    assertTrue( "Check if relocated artifact created", Files.exists(artifactFile) );
    assertTrue( "Check if relocated artifact matches",
                FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
    Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
    Path pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
    Path testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) );
    compareFiles( pomFile, testFile );

    Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
    artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
    assertTrue( "Check if relocation artifact pom is created", Files.exists(artifactFile) );
    testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
    compareFiles( artifactFile, testFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java

示例10: testV3PomWarningsOnConvert

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Test
public void testV3PomWarningsOnConvert()
    throws Exception
{
    // test that the pom is converted but that warnings are reported

    Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" );
    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    Files.deleteIfExists(artifactMetadataFile);

    ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
    Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
                                         targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
    Files.deleteIfExists(versionMetadataFile);

    artifactConverter.convert( artifact, targetRepository );
    checkWarnings( artifactConverter, 2 );

    Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    assertTrue( "Check artifact created", Files.exists(artifactFile) );
    assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );

    artifact = createPomArtifact( artifact );
    Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    Path expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( expectedPomFile, pomFile );

    // TODO: check 2 warnings (extend and versions) matched on i18n key
}
 
开发者ID:apache,项目名称:archiva,代码行数:34,代码来源:LegacyToDefaultConverterTest.java

示例11: testMergeArtifactMetadata

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
@Test
public void testMergeArtifactMetadata()
    throws Exception
{
    // test artifact level metadata is merged when it already exists on successful conversion

    Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" );
    artifactConverter.convert( artifact, targetRepository );
    checkSuccess( artifactConverter );

    Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    assertTrue( "Check artifact created", Files.exists(artifactFile) );
    assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );

    artifact = createPomArtifact( artifact );
    Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
    Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
    assertTrue( "Check POM created", Files.exists(pomFile) );

    compareFiles( sourcePomFile, pomFile );

    ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
    Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
                                          targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
    assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );

    Path expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" );

    compareFiles( expectedMetadataFile, artifactMetadataFile );
}
 
开发者ID:apache,项目名称:archiva,代码行数:31,代码来源:LegacyToDefaultConverterTest.java

示例12: getArtifactMetadata

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
public void getArtifactMetadata( ArtifactMetadata metadata, ArtifactRepository repository, File destination,
                                 String checksumPolicy )
    throws TransferFailedException, ResourceDoesNotExistException
{
    String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );

    getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:9,代码来源:DefaultWagonManager.java

示例13: getArtifactMetadataFromDeploymentRepository

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
public void getArtifactMetadataFromDeploymentRepository( ArtifactMetadata metadata, ArtifactRepository repository,
                                                         File destination, String checksumPolicy )
    throws TransferFailedException, ResourceDoesNotExistException
{
    String remotePath = repository.pathOfRemoteRepositoryMetadata( metadata );

    getRemoteFile( repository, destination, remotePath, null, checksumPolicy, true );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:9,代码来源:DefaultWagonManager.java

示例14: transformForDeployment

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
public void transformForDeployment( Artifact artifact, ArtifactRepository remoteRepository,
                                    ArtifactRepository localRepository )
{
    ArtifactMetadata metadata = createMetadata( artifact );

    artifact.addMetadata( metadata );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:8,代码来源:ReleaseArtifactTransformation.java

示例15: createMetadata

import org.apache.maven.artifact.metadata.ArtifactMetadata; //导入依赖的package包/类
private ArtifactMetadata createMetadata( Artifact artifact )
{
    Versioning versioning = new Versioning();
    versioning.updateTimestamp();
    versioning.addVersion( artifact.getVersion() );

    if ( artifact.isRelease() )
    {
        versioning.setRelease( artifact.getVersion() );
    }

    return new ArtifactRepositoryMetadata( artifact, versioning );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:14,代码来源:ReleaseArtifactTransformation.java


注:本文中的org.apache.maven.artifact.metadata.ArtifactMetadata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。