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


Java ArtifactUtils.copyArtifact方法代码示例

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


在下文中一共展示了ArtifactUtils.copyArtifact方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CacheKey

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public CacheKey( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
                 List<ArtifactRepository> remoteRepositories )
{
    File file = artifact.getFile();
    this.artifact = ArtifactUtils.copyArtifact( artifact );
    if ( "pom".equals( artifact.getType() ) && file != null )
    {
        pomHash = file.getPath().hashCode() + file.lastModified();
    }
    else
    {
        pomHash = 0;
    }
    this.resolveManagedVersions = resolveManagedVersions;
    this.repositories.add( localRepository );
    this.repositories.addAll( remoteRepositories );

    int hash = 17;
    hash = hash * 31 + artifactHashCode( artifact );
    hash = hash * 31 + ( resolveManagedVersions ? 1 : 2 );
    hash = hash * 31 + repositoriesHashCode( repositories );
    this.hashCode = hash;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:24,代码来源:DefaultMavenMetadataCache.java

示例2: get

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public ResolutionGroup get( Artifact artifact, boolean resolveManagedVersions, ArtifactRepository localRepository,
                            List<ArtifactRepository> remoteRepositories )
{
    CacheKey cacheKey = newCacheKey( artifact, resolveManagedVersions, localRepository, remoteRepositories );

    CacheRecord cacheRecord = cache.get( cacheKey );

    if ( cacheRecord != null && !cacheRecord.isStale() )
    {
        Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() );
        Artifact relocatedArtifact = ArtifactUtils.copyArtifactSafe( cacheRecord.getRelocatedArtifact() );
        Set<Artifact> artifacts =
            ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<Artifact>() );
        Map<String, Artifact> managedVersions = cacheRecord.getManagedVersions();
        if ( managedVersions != null )
        {
            managedVersions = ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
        }
        return new ResolutionGroup( pomArtifact, relocatedArtifact, artifacts, managedVersions,
                                    cacheRecord.getRemoteRepositories() );
    }

    cache.remove( cacheKey );

    return null;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:27,代码来源:DefaultMavenMetadataCache.java

示例3: mojoStarted

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
@Override
public void mojoStarted( ExecutionEvent event )
{
    if (event.getMojoExecution().getExecutionId() != null && event.getMojoExecution().getExecutionId().endsWith("-snapshot")) {

        frozenPomFile = event.getProject().getFile();
        event.getProject().setFile(new File( frozenPomFile.getParent(), MavenConventions.POM_FILE));

        frozenArtifact = event.getProject().getArtifact();
        Artifact snapshotArtifact = ArtifactUtils.copyArtifact(frozenArtifact);
        snapshotArtifact.setVersion(transformToSnapshotVersion(frozenArtifact.getVersion()));
        event.getProject().setArtifact(snapshotArtifact);

        if (!isPomArtifact(event.getProject())) {
            frozenFinalName = event.getProject().getBuild().getFinalName();
            event.getProject().getBuild().setFinalName(transformToSnapshot(frozenFinalName, frozenArtifact, snapshotArtifact));

            event.getProject().getArtifact().setFile(new File(transformToSnapshot(frozenArtifact.getFile().getAbsolutePath(), frozenArtifact, snapshotArtifact)));
            logger.info("[SnapshotExecutionListener]: Switched frozenArtifact file to " + transformToSnapshot(frozenArtifact.getFile().getAbsolutePath(), frozenArtifact, snapshotArtifact));
        }
        frozenAttachedArtifacts = new LinkedList<Artifact>();

        for (Artifact attachedArtifact : event.getProject().getAttachedArtifacts()) {
            String attachedFileAbsolutePath = attachedArtifact.getFile().getAbsolutePath();
            logger.info("[SnapshotExecutionListener]: Attached frozenArtifact file : " + attachedFileAbsolutePath);
            frozenAttachedArtifacts.add(attachedArtifact);
        }
        event.getProject().getAttachedArtifacts().clear();
        for (Artifact frozenAttachedArtifact : frozenAttachedArtifacts) {
            Artifact unfrozenAttachedArtifact = ArtifactUtils.copyArtifact(frozenAttachedArtifact);
            unfrozenAttachedArtifact.setVersion(transformToSnapshot(unfrozenAttachedArtifact.getVersion(), frozenArtifact, snapshotArtifact));
            event.getProject().addAttachedArtifact(unfrozenAttachedArtifact);
        }
    }
}
 
开发者ID:rvs-fluid-it,项目名称:mvn-fluid-cd,代码行数:36,代码来源:SnapshotExecutionListener.java

示例4: CacheRecord

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
CacheRecord( Artifact pomArtifact, Artifact relocatedArtifact, Set<Artifact> artifacts,
             Map<String, Artifact> managedVersions, List<ArtifactRepository> remoteRepositories )
{
    this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact );
    this.relocatedArtifact = ArtifactUtils.copyArtifactSafe( relocatedArtifact );
    this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<Artifact>() );
    this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );

    this.managedVersions = managedVersions;
    if ( managedVersions != null )
    {
        this.managedVersions =
            ArtifactUtils.copyArtifacts( managedVersions, new LinkedHashMap<String, Artifact>() );
    }

    File pomFile = pomArtifact.getFile();
    if ( pomFile != null && pomFile.canRead() )
    {
        this.length = pomFile.length();
        this.timestamp = pomFile.lastModified();
    }
    else
    {
        this.length = -1;
        this.timestamp = -1;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:28,代码来源:DefaultMavenMetadataCache.java

示例5: checkForUpdate

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
/**
 * Checks if a new version is available for the currently executed plugin.
 *
 * @return the most recent version available or nothing if the running plugin is of newer or equal version
 * @since 2.0.0
 */
@Nonnull
public Optional<ArtifactVersion> checkForUpdate(@Nonnull MojoExecution mojoExecution) {
    Logger logger = LoggerFactory.getLogger(getClass());
    try {
        if (legacySupport.getSession().isOffline()) {
            logger.info("Running in offline mode; skipping update check.");
            return absent();
        }
        Artifact artifact = ArtifactUtils.copyArtifact(
                mojoExecution.getMojoDescriptor().getPluginDescriptor().getPluginArtifact());
        ArtifactVersion versionInUse = artifact.getVersionRange().getRecommendedVersion();
        ArtifactRepositoryMetadata repositoryMetadata = new ArtifactRepositoryMetadata(artifact);
        repositoryMetadataManager.resolve(repositoryMetadata, legacySupport.getSession().getCurrentProject().getPluginArtifactRepositories(), legacySupport.getSession().getLocalRepository());
        ArtifactVersion newestVersion = versionInUse;
        for (String version : repositoryMetadata.getMetadata().getVersioning().getVersions()) {
            ArtifactVersion artifactVersion = new DefaultArtifactVersion(version);
            if ("SNAPSHOT".equals(artifactVersion.getQualifier())) {
                continue;
            }
            if (artifactVersion.compareTo(newestVersion) > 0) {
                newestVersion = artifactVersion;
            }
        }
        if (versionInUse.compareTo(newestVersion) >= 0) {
            logger.debug("Running latest version.");
        } else {
            logger.debug("New plugin version [{}] is available.", newestVersion);
            return Optional.of(newestVersion);
        }
    } catch (Exception e) {
        logger.debug("Update check failed!", e);
        logger.warn("Update check failed: {}", e.getMessage());
    }
    return absent();
}
 
开发者ID:ImmobilienScout24,项目名称:deadcode4j,代码行数:42,代码来源:UpdateChecker.java


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