Package org.apache.maven.artifact.versioning

Examples of org.apache.maven.artifact.versioning.DefaultArtifactVersion


        result = 31 * result + (type != null ? type.hashCode() : 0);
        return result;
    }

    public void setArtifactVersion(String version) {
        artifactVersion = new DefaultArtifactVersion(version);
    }
View Full Code Here


                        public int compare( ArtifactMetadata o1, ArtifactMetadata o2 )
                        {
                            // sort by version (reverse), then ID
                            // TODO: move version sorting into repository handling (maven2 specific), and perhaps add a
                            // way to get latest instead
                            int result = new DefaultArtifactVersion( o2.getVersion() ).compareTo(
                                new DefaultArtifactVersion( o1.getVersion() ) );
                            return result != 0 ? result : o1.getId().compareTo( o2.getId() );
                        }
                    } );

                    for ( ArtifactMetadata artifact : artifacts )
View Full Code Here

                artifactVersions = new ArrayList();
                versions.put( key, artifactVersions );
            }
            if ( spec.artifact.getVersion() != null )
            {
                artifactVersions.add( new DefaultArtifactVersion( spec.artifact.getVersion() ) );
            }
        }
View Full Code Here

                artifactVersions = new ArrayList();
                versions.put( key, artifactVersions );
            }
            if ( spec.artifact.getVersion() != null )
            {
                artifactVersions.add( new DefaultArtifactVersion( spec.artifact.getVersion() ) );
            }
        }
View Full Code Here

        if ( StringUtils.isEmpty( mavenVersion ) )
        {
            throw new InitializationException( "Unable to read Maven version from maven-core" );
        }

        applicationVersion = new DefaultArtifactVersion( mavenVersion );
    }
View Full Code Here

            if ( property == null )
            {
                throw new InitializationException( "maven-core properties did not include the version" );
            }

            applicationVersion = new DefaultArtifactVersion( property );
        }
        catch ( IOException e )
        {
            throw new InitializationException( "Unable to read properties file from maven-core", e );
        }
View Full Code Here

        List<ArtifactVersion> artifactVersions = new ArrayList<ArtifactVersion>( versions.size() );

        for ( String version : versions )
        {
            artifactVersions.add( new DefaultArtifactVersion( version ) );
        }

        return artifactVersions;
    }
View Full Code Here

     * Convert the maven version into OSGi version
     * @param mavenVersion
     * @return
     */
    static String osgiVersion(String mavenVersion) {
        ArtifactVersion ver = new DefaultArtifactVersion(mavenVersion);
        String qualifer = ver.getQualifier();
        if (qualifer != null) {
            StringBuffer buf = new StringBuffer(qualifer);
            for (int i = 0; i < buf.length(); i++) {
                char c = buf.charAt(i);
                if (Character.isLetterOrDigit(c) || c == '-' || c == '_') {
                    // Keep as-is
                } else {
                    buf.setCharAt(i, '_');
                }
            }
            qualifer = buf.toString();
        }
        Version osgiVersion =
            new Version(ver.getMajorVersion(), ver.getMinorVersion(), ver.getIncrementalVersion(), qualifer);
        String version = osgiVersion.toString();
        return version;
    }
View Full Code Here

     * Convert the maven version into OSGi version
     * @param mavenVersion
     * @return
     */
    static String osgiVersion(String mavenVersion) {
        ArtifactVersion ver = new DefaultArtifactVersion(mavenVersion);
        String qualifer = ver.getQualifier();
        if (qualifer != null) {
            StringBuffer buf = new StringBuffer(qualifer);
            for (int i = 0; i < buf.length(); i++) {
                char c = buf.charAt(i);
                if (Character.isLetterOrDigit(c) || c == '-' || c == '_') {
                    // Keep as-is
                } else {
                    buf.setCharAt(i, '_');
                }
            }
            qualifer = buf.toString();
        }
        Version osgiVersion =
            new Version(ver.getMajorVersion(), ver.getMinorVersion(), ver.getIncrementalVersion(), qualifer);
        String version = osgiVersion.toString();
        return version;
    }
View Full Code Here

            // TODO: this is pretty manual, but I'd rather not require the plugin > dependencies section right now
            testNgArtifact = (Artifact)projectArtifactMap.get(testNGArtifactName);

            if (testNgArtifact != null) {
                VersionRange range = VersionRange.createFromVersionSpec("[4.7,)");
                if (!range.containsVersion(new DefaultArtifactVersion(testNgArtifact.getVersion()))) {
                    throw new MojoFailureException(
                                                   "TestNG support requires version 4.7 or above. You have declared version " + testNgArtifact
                                                       .getVersion());
                }
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.versioning.DefaultArtifactVersion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.