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


Java InvalidVersionSpecificationException.getMessage方法代码示例

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


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

示例1: createManagedVersionMap

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
/**
 *
 * @param projectId
 * @param dependencyManagement
 * @return
 * @throws ProjectBuildingException
 */
private Map createManagedVersionMap(String projectId, DependencyManagement dependencyManagement) throws ProjectBuildingException {
    Map map;
    if (dependencyManagement != null && dependencyManagement.getDependencies() != null) {
        map = new HashMap();
        for (Dependency d : dependencyManagement.getDependencies()) {
            try {
                VersionRange versionRange = VersionRange.createFromVersionSpec(d.getVersion());
                Artifact artifact = factory.createDependencyArtifact(d.getGroupId(), d.getArtifactId(),
                        versionRange, d.getType(), d.getClassifier(),
                        d.getScope());
                map.put(d.getManagementKey(), artifact);
            } catch (InvalidVersionSpecificationException e) {
                throw new ProjectBuildingException(projectId, "Unable to parse version '" + d.getVersion()
                        + "' for dependency '" + d.getManagementKey() + "': " + e.getMessage(), e);
            }
        }
    } else {
        map = Collections.EMPTY_MAP;
    }
    return map;
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:29,代码来源:ConfluenceDeployMojo.java

示例2: toArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
/**
 * Try to find the dependency artifact that matches the given dependency.
 *
 * @param dependency
 * @return
 * @since 1.0-alpha-3
 */
protected Artifact toArtifact( Dependency dependency )
    throws MojoExecutionException
{
    Artifact artifact = findArtifact( dependency );
    if ( artifact == null )
    {
        try
        {
            return getHelper().createDependencyArtifact( dependency );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
    }
    return artifact;
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:25,代码来源:AbstractVersionsDependencyUpdaterMojo.java

示例3: createDependencyArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
private Artifact createDependencyArtifact( Dependency dependency, Artifact owner, Artifact pom )
    throws ArtifactMetadataRetrievalException
{
    try
    {
        String inheritedScope = ( owner != null ) ? owner.getScope() : null;

        ArtifactFilter inheritedFilter = ( owner != null ) ? owner.getDependencyFilter() : null;

        return createDependencyArtifact( repositorySystem, dependency, inheritedScope, inheritedFilter );
    }
    catch ( InvalidVersionSpecificationException e )
    {
        throw new ArtifactMetadataRetrievalException( "Invalid version for dependency "
            + dependency.getManagementKey() + ": " + e.getMessage(), e, pom );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:18,代码来源:MavenMetadataSource.java

示例4: createManagedVersionMap

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
protected Map createManagedVersionMap(String projectId,
        DependencyManagement dependencyManagement) throws ProjectBuildingException {
    Map map;
    if (dependencyManagement != null
            && dependencyManagement.getDependencies() != null) {
        map = new HashMap();
        for (Iterator i = dependencyManagement.getDependencies().iterator(); i
                .hasNext();) {
            Dependency d = (Dependency) i.next();

            try {
                VersionRange versionRange = VersionRange
                        .createFromVersionSpec(d.getVersion());
                Artifact artifact = factory.createDependencyArtifact(d
                        .getGroupId(), d.getArtifactId(), versionRange, d
                        .getType(), d.getClassifier(), d.getScope());
                map.put(d.getManagementKey(), artifact);
            } catch (InvalidVersionSpecificationException e) {
                throw new ProjectBuildingException(projectId,
                        "Unable to parse version '" + d.getVersion()
                                + "' for dependency '"
                                + d.getManagementKey() + "': "
                                + e.getMessage(), e);
            }
        }
    } else {
        map = Collections.EMPTY_MAP;
    }
    return map;
}
 
开发者ID:hitakaken,项目名称:bigfoot-maven-plugins,代码行数:31,代码来源:AbstractJbiMojo.java

示例5: isActive

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
public boolean isActive( Profile profile )
    throws ProfileActivationException
{
    Activation activation = profile.getActivation();

    String jdk = activation.getJdk();

    // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here.
    if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) )
    {
        try
        {
            return matchJdkVersionRange( jdk );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
                + e.getMessage() );
        }
    }

    boolean reverse = false;

    if ( jdk.startsWith( "!" ) )
    {
        reverse = true;
        jdk = jdk.substring( 1 );
    }

    if ( getJdkVersion().startsWith( jdk ) )
    {
        return !reverse;
    }
    else
    {
        return reverse;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:39,代码来源:JdkPrefixProfileActivator.java

示例6: getComparisonArtifact

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
private Artifact getComparisonArtifact()
    throws MojoFailureException, MojoExecutionException
{
    // Find the previous version JAR and resolve it, and it's dependencies
    VersionRange range;
    try
    {
        range = VersionRange.createFromVersionSpec( comparisonVersion );
    }
    catch ( InvalidVersionSpecificationException e )
    {
        throw new MojoFailureException( "Invalid comparison version: " + e.getMessage() );
    }

    Artifact previousArtifact;
    try
    {
        previousArtifact = factory.createDependencyArtifact( project.getGroupId(), project.getArtifactId(), range,
                                                             project.getPackaging(), null, Artifact.SCOPE_COMPILE );

        if ( !previousArtifact.getVersionRange().isSelectedVersionKnown( previousArtifact ) )
        {
            getLog().debug( "Searching for versions in range: " + previousArtifact.getVersionRange() );
            List availableVersions = metadataSource.retrieveAvailableVersions( previousArtifact, localRepository,
                                                                               project.getRemoteArtifactRepositories() );
            filterSnapshots( availableVersions );
            ArtifactVersion version = range.matchVersion( availableVersions );
            if ( version != null )
            {
                previousArtifact.selectVersion( version.toString() );
            }
        }
    }
    catch ( OverConstrainedVersionException e1 )
    {
        throw new MojoFailureException( "Invalid comparison version: " + e1.getMessage() );
    }
    catch ( ArtifactMetadataRetrievalException e11 )
    {
        throw new MojoExecutionException( "Error determining previous version: " + e11.getMessage(), e11 );
    }

    if ( previousArtifact.getVersion() == null )
    {
        getLog().info( "Unable to find a previous version of the project in the repository" );
    }

    return previousArtifact;
}
 
开发者ID:mojohaus,项目名称:clirr-maven-plugin,代码行数:50,代码来源:AbstractClirrMojo.java

示例7: ArtifactHolder

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
public ArtifactHolder(Log log, ArtifactDependencyResolver resolver, List<MavenProject> reactorProjects) throws MojoExecutionException {
    // collect
    reactorArtifacts = new HashSet<Artifact>();
    for (MavenProject reactorProject : reactorProjects)
        reactorArtifacts.add(reactorProject.getArtifact());
    reactorArtifacts = Collections.unmodifiableSet(reactorArtifacts);

    // Resolve
    Map<MavenProject, ArtifactDependencyResolver.DependencyData> dependencyDataNewMap;
    try {
        dependencyDataNewMap = resolver.findDependencies(reactorProjects);
    } catch (InvalidVersionSpecificationException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }

    // Find common dependencies
    Set<Artifact> fullSet = new HashSet<Artifact>();
    for (ArtifactDependencyResolver.DependencyData data : dependencyDataNewMap.values())
        fullSet.addAll(data.getRemoteList());

    // Save allDependencies
    allDependencies = new ArrayList<Artifact>(fullSet);
    Collections.sort(allDependencies, ArtifactComparator.INSTANCE);
    allDependencies = Collections.unmodifiableList(allDependencies);

    log.info("");
    log.info("Full Dependencies");
    log.info("");
    for (Artifact artifact : allDependencies)
        log.info("  " + artifact.getId());

    // Save dependencyMap

    this.dependencyMap = new HashMap<MavenProject, List<Artifact>>();
    for (Map.Entry<MavenProject, ArtifactDependencyResolver.DependencyData> entry : dependencyDataNewMap.entrySet()) {
        MavenProject project = entry.getKey();
        // Remove commonSet from dependencies
        List<Artifact> remoteList = new ArrayList<Artifact>(entry.getValue().getRemoteList());
        List<Artifact> reactorList = new ArrayList<Artifact>(entry.getValue().getReactorList());
        Collections.sort(remoteList, ArtifactComparator.INSTANCE);
        Collections.sort(reactorList, ArtifactComparator.INSTANCE);
        List<Artifact> artifacts = new ArrayList<Artifact>();
        artifacts.addAll(reactorList);
        artifacts.addAll(remoteList);
        this.dependencyMap.put(project, Collections.unmodifiableList(artifacts));
    }
}
 
开发者ID:zhve,项目名称:idea-maven-plugin,代码行数:48,代码来源:ArtifactHolder.java

示例8: formatMessage

import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; //导入方法依赖的package包/类
private static String formatMessage( String projectId, String locationInPom, String offendingVersion,
                                     InvalidVersionSpecificationException cause )
{
    return "Invalid version: " + offendingVersion + " found for: " + locationInPom + " in project: " + projectId
        + ". Reason: " + cause.getMessage();
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:7,代码来源:InvalidProjectVersionException.java


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