Convert a {@link Artifact} to String notation of
groupId:artifactId::type:classifier:version

@param artifact {@link Artifact}
@return String notation
164129
public static String generate(Artifact artifact) {
        StringBuilder notation = new StringBuilder()
            .append(artifact.getGroupId()).append(":")
            .append(artifact.getArtifactId()).append(":")
            .append(artifact.getExtension()).append(":");

        if ( artifact.getClassifier() != null && artifact.getClassifier().length() > 0 ) {
            notation.append(artifact.getClassifier()).append(":");
        }

        notation.append(artifact.getBaseVersion());

        return notation.toString();
    }
881338
public String getIdFromVersion(String version)
    {
        MessageVersion recMessageVersion = this.getMessageVersion(version);
        String idVersion = DBConstants.BLANK;
        if ((idVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
            idVersion = recMessageVersion.getField(MessageVersion.VERSION_ID).toString();
        if ((idVersion == null) || (idVersion.length() == 0))
            idVersion = "OTA" + version;
        return idVersion;
    }
1306189
public static String getVersion(Class<?> aClass, String groupId, String artifactId) {
        String version = null;
        // lets try find the maven property - as the Java API rarely works :)
        InputStream is = null;
        String fileName = "/META-INF/maven/" +
                groupId + "/" + artifactId +
                "/pom.properties";
        // try to load from maven properties first
        try {
            Properties p = new Properties();
            is = aClass.getResourceAsStream(fileName);
            if (is != null) {
                p.load(is);
                version = p.getProperty("version", "");
            }
        } catch (Exception e) {
            // ignore
        } finally {
            if (is != null) {
                IOHelper.close(is, fileName, LOG);
            }
        }
        if (version == null) {
            Package aPackage = aClass.getPackage();
            if (aPackage != null) {
                version = aPackage.getImplementationVersion();
                if (Strings.isBlank(version)) {
                    version = aPackage.getSpecificationVersion();
                }
            }
        }
        if (version == null) {
            Enumeration<URL> resources = null;
            try {
                resources = aClass.getClassLoader().getResources("META-INF/MANIFEST.MF");
            } catch (IOException e) {
                // ignore
            }
            if (resources != null) {
                String expectedBundleName = groupId + "." + artifactId;
                while (resources.hasMoreElements()) {
                    try {
                        Manifest manifest = new Manifest(resources.nextElement().openStream());
                        Attributes attributes = manifest.getMainAttributes();
                        String bundleName = attributes.getValue("Bundle-SymbolicName");
                        if (Objects.equals(expectedBundleName, bundleName)) {
                            version = attributes.getValue("Implementation-Version");
                            if (Strings.isNotBlank(version)) break;
                        }
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }
        }
        return version;
    }
429720
public ArchiveCoordinateModel findSingle(String groupId, String artifactId, String version)
    {
        Iterable<ArchiveCoordinateModel> archives = findByGAV(groupId, artifactId, version);
        Iterator<ArchiveCoordinateModel> it = archives.iterator();
        if (!it.hasNext())
            return null;
        ArchiveCoordinateModel archive = it.next();
        if (it.hasNext())
            LOG.warning(String.format("There are multiple %s's like this: %s:%s:%s",
                        ArchiveCoordinateModel.class.getSimpleName(), groupId, artifactId, version));
        return archive;
    }
1036184
String toGradleArtifactPath(ArtifactCoordinates artifactCoordinates) {
        // e.g.: org/jboss/ws/cxf/jbossws-cxf-resources/5.1.5.Final/jbossws-cxf-resources-5.1.5.Final
        String pathWithMissingClassifier = artifactCoordinates.relativeArtifactPath('/');
        StringBuilder sb = new StringBuilder(pathWithMissingClassifier);

        if (artifactCoordinates.getClassifier() != null && artifactCoordinates.getClassifier().length() > 0) {
            // org/jboss/ws/cxf/jbossws-cxf-resources/5.1.5.Final/jbossws-cxf-resources-5.1.5.Final-wildfly1000
            sb
                    .append("-")
                    .append(artifactCoordinates.getClassifier());
        }

        return sb.toString();
    }
398623
@Override
    public File findArtifact(final Artifact artifact) {
        String type = artifact.getProperty("type", "jar");
        if ("ceylon-jar".equals(type) || "car".equals(type)) {
            if ("ceylon-jar".equals(type)) {
                type = "jar";
            }

            File art = new File(CeylonUtil.ceylonSystemFullPath(artifact, type));
            
            if (art.isFile()) {
            	 if (logger != null) {
            		 logger.info("Resolved from Ceylon repo: " + artifact);
            	 }
                artifact.setFile(art);
                return art;
            }
        } 
        return null;
    }
249037
public URI getPath(final org.eclipse.aether.artifact.Artifact artifact) {
        return toUri(pathOf(new DefaultArtifact(artifact.getGroupId(), 
            artifact.getArtifactId(), artifact.getBaseVersion(),
            "", artifact.getExtension(),
            artifact.getClassifier(), new DefaultArtifactHandler(artifact.getExtension()))));
    }
842575
protected static String formatApiVersion(String version) {
        if (StringUtils.isBlank(version)) {
            return VERSION;
        } else {
            final Matcher matcher = VERSION_PATTERN.matcher(version);
            if (matcher.matches()) {
                return String.format("%s.%s", matcher.group(1), matcher.group(2));
            } else {
                return VERSION;
            }
        }
    }
242011
private Artifact getArtifactFromMavenCoordinates(final String artifact) throws MojoFailureException {

    String[] parts = StringUtils.split(artifact, ":");

    String version;
    String packaging = null;
    String classifier = null;

    switch (parts.length) {
      case 3:
        // groupId:artifactId:version
        version = parts[2];
        break;

      case 4:
        // groupId:artifactId:packaging:version
        packaging = parts[2];
        version = parts[3];
        break;

      case 5:
        // groupId:artifactId:packaging:classifier:version
        packaging = parts[2];
        classifier = parts[3];
        version = parts[4];
        break;

      default:
        throw new MojoFailureException("Invalid artifact: " + artifact);
    }

    String groupId = parts[0];
    String artifactId = parts[1];

    return createArtifact(artifactId, groupId, version, packaging, classifier);
  }
779240
public static Artifact withArtifactId(String artifactId)
    {
        Artifact artifact = new Artifact();
        artifact.artifactId = new RegexParameterizedPatternParser(artifactId);
        return artifact;
    }
211229
private String getProjectReferenceId( final String groupId, final String artifactId, final String version )
    {
        return groupId + ":" + artifactId + ":" + version;
    }
854699
private static File artifactToFile(final Artifact artifact) throws IllegalArgumentException {
        if (artifact == null) {
            throw new IllegalArgumentException("ArtifactResult must not be null");
        }

        // FIXME: this is not a safe assumption, file can have a different name
        if ("pom.xml".equals(artifact.getFile().getName())) {

            String artifactId = artifact.getArtifactId();
            String extension = artifact.getExtension();
            String classifier = artifact.getClassifier();

            File root = new File(artifact.getFile().getParentFile(), "target/classes");
            if (!Validate.isNullOrEmpty(classifier) && "tests".equals(classifier)) {
                // SHRINKRES-102, allow test classes to be packaged as well
                root = new File(artifact.getFile().getParentFile(), "target/test-classes");
            } else if ("war".equals(artifact.getProperty(ArtifactProperties.TYPE, null))) {
                // SHRINKRES-263, allow .war files to be packaged as well
                root = new File(artifact.getFile().getParentFile(), "target/" + artifactId + "-" + artifact.getVersion());
            }

            try {
                File archive = File.createTempFile(artifactId + "-", "." + extension);
                archive.deleteOnExit();
                PackageDirHelper.packageDirectories(archive, root);
                return archive;
            } catch (IOException e) {
                throw new IllegalArgumentException("Unable to get artifact " + artifactId + " from the classpath", e);

            }

        } else {
            return artifact.getFile();
        }
    }
109849
public static String getArtifactoryPluginVersion() {
        String pluginsSortName = "artifactory";
        //Validates Jenkins existence because in some jobs the Jenkins instance is unreachable
        if (Jenkins.getInstance() != null
                && Jenkins.getInstance().getPlugin(pluginsSortName) != null
                && Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper() != null) {
            return Jenkins.getInstance().getPlugin(pluginsSortName).getWrapper().getVersion();
        }
        return "";
    }
4797
@Override
    public String toCanonicalForm() {
        return new StringBuilder(groupId).append(SEPARATOR_COORDINATE).append(artifactId).toString();
    }
485169
public static Artifact withVersion(Version v)
    {
        Artifact artifact = new Artifact();
        artifact.version = v;
        return artifact;
    }
1220560
public void parseVersion( String version )
    {
        DefaultVersioning artifactVersion = new DefaultVersioning( version );

        getLog().debug( "Parsed Version" );
        getLog().debug( "         major: " + artifactVersion.getMajor() );
        getLog().debug( "         minor: " + artifactVersion.getMinor() );
        getLog().debug( "   incremental: " + artifactVersion.getPatch() );
        getLog().debug( "   buildnumber: " + artifactVersion.getBuildNumber() );
        getLog().debug( "     qualifier: " + artifactVersion.getQualifier() );

        defineVersionProperty( "majorVersion", artifactVersion.getMajor() );
        defineVersionProperty( "minorVersion", artifactVersion.getMinor() );
        defineVersionProperty( "incrementalVersion", artifactVersion.getPatch() );
        defineVersionProperty( "buildNumber", artifactVersion.getBuildNumber() );

        defineVersionProperty( "nextMajorVersion", artifactVersion.getMajor() + 1 );
        defineVersionProperty( "nextMinorVersion", artifactVersion.getMinor() + 1 );
        defineVersionProperty( "nextIncrementalVersion", artifactVersion.getPatch() + 1 );
        defineVersionProperty( "nextBuildNumber", artifactVersion.getBuildNumber() + 1 );

        defineFormattedVersionProperty( "majorVersion", String.format( formatMajor, artifactVersion.getMajor() ) );
        defineFormattedVersionProperty( "minorVersion", String.format( formatMinor, artifactVersion.getMinor() ) );
        defineFormattedVersionProperty( "incrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() ) );
        defineFormattedVersionProperty( "buildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() ));

        defineFormattedVersionProperty( "nextMajorVersion", String.format( formatMajor, artifactVersion.getMajor() + 1 ));
        defineFormattedVersionProperty( "nextMinorVersion", String.format( formatMinor, artifactVersion.getMinor() + 1 ));
        defineFormattedVersionProperty( "nextIncrementalVersion", String.format( formatIncremental, artifactVersion.getPatch() + 1 ));
        defineFormattedVersionProperty( "nextBuildNumber", String.format( formatBuildNumber, artifactVersion.getBuildNumber() + 1 ));
        
        String osgi = artifactVersion.getAsOSGiVersion();

        String qualifier = artifactVersion.getQualifier();
        String qualifierQuestion = "";
        if ( qualifier == null )
        {
            qualifier = "";
        } else {
            qualifierQuestion = qualifierPrefix;
        }

        defineVersionProperty( "qualifier", qualifier );
        defineVersionProperty( "qualifier?", qualifierQuestion + qualifier );

        defineVersionProperty( "osgiVersion", osgi );
    }
615259
private void resolveArtifacts( List<Artifact> artifacts, String artifactGAVs )
        throws ArtifactNotFoundException, ArtifactResolutionException
    {
        if ( artifactGAVs != null && artifactGAVs.trim().length() > 0 )
        {
            String[] scalacPluginsGAVs = artifactGAVs.trim().split( " " );
            for ( String scalacPluginGAV : scalacPluginsGAVs )
            {
                String[] gav = scalacPluginGAV.split( ":" );
                String groupId = gav[ 0 ];
                String artifactId = gav[ 1 ];
                String version = gav[ 2 ];
                Artifact scalacPluginArtifact = getResolvedArtifact( groupId, artifactId, version );
                if ( scalacPluginArtifact != null )
                {
                    artifacts.add( scalacPluginArtifact );
                }
            }
        }
    }