Java Code Examples for org.apache.maven.artifact.Artifact#getType()

The following examples show how to use org.apache.maven.artifact.Artifact#getType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExcludeDependencyPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void setReferenceTree(CheckNode mtb) {
    Artifact art = (Artifact) mtb.getUserObject();
    if (modelCache.containsKey(art)) {
        trRef.setModel(modelCache.get(art));
    } else {
        if (rootnode == null) {
            trRef.setModel(new DefaultTreeModel(new DefaultMutableTreeNode()));
        } else {
            DependencyExcludeNodeVisitor nv = new DependencyExcludeNodeVisitor(art.getGroupId(), art.getArtifactId(), art.getType());
            rootnode.accept(nv);
            Set<DependencyNode> nds = nv.getDirectDependencies();
            DefaultTreeModel dtm = new DefaultTreeModel(createReferenceModel(nds, mtb));
            trRef.setModel(dtm);
            modelCache.put(art, dtm);
        }
    }
}
 
Example 2
Source File: BaseCycloneDxMojo.java    From cyclonedx-maven-plugin with Apache License 2.0 6 votes vote down vote up
private String generatePackageUrl(final Artifact artifact) {
    try {
        TreeMap<String, String> qualifiers = null;
        if (artifact.getType() != null || artifact.getClassifier() != null) {
            qualifiers = new TreeMap<>();
            if (artifact.getType() != null) {
                qualifiers.put("type", artifact.getType());
            }
            if (artifact.getClassifier() != null) {
                qualifiers.put("classifier", artifact.getClassifier());
            }
        }
        return new PackageURL(PackageURL.StandardTypes.MAVEN,
                artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), qualifiers, null).canonicalize();
    } catch (MalformedPackageURLException e) {
        getLog().warn("An unexpected issue occurred attempting to create a PackageURL for "
                + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion(), e);
    }
    return null;
}
 
Example 3
Source File: UseLatestReleasesMojo.java    From versions-maven-plugin with Apache License 2.0 6 votes vote down vote up
private ArtifactVersion[] filterVersionsWithIncludes( ArtifactVersion[] newer, Artifact artifact )
{
    List<ArtifactVersion> filteredNewer = new ArrayList<>( newer.length );
    for ( int j = 0; j < newer.length; j++ )
    {
        ArtifactVersion artifactVersion = newer[j];
        Artifact artefactWithNewVersion =
            new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                                 VersionRange.createFromVersion( artifactVersion.toString() ), artifact.getScope(),
                                 artifact.getType(), null, new DefaultArtifactHandler(), false );
        if ( isIncluded( artefactWithNewVersion ) )
        {
            filteredNewer.add( artifactVersion );
        }
    }
    return filteredNewer.toArray( new ArtifactVersion[filteredNewer.size()] );
}
 
Example 4
Source File: BotsingMojo.java    From botsing with Apache License 2.0 5 votes vote down vote up
private File getArtifactFile(Artifact artifact) throws MojoExecutionException {
	/**
	 * Taken from https://gist.github.com/vincent-zurczak/282775f56d27e12a70d3
	 */
	DefaultArtifact aetherArtifact = new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(),
			artifact.getClassifier(), artifact.getType(), artifact.getVersion());

	return getArtifactFile(aetherArtifact);
}
 
Example 5
Source File: AbstractCodegenMojo.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isArtifactMatched(Artifact targetArtifact, Artifact pArtifact) {
    return targetArtifact.getGroupId().equals(pArtifact.getGroupId())
            && targetArtifact.getArtifactId().equals(pArtifact.getArtifactId())
            && targetArtifact.getVersion().equals(pArtifact.getVersion())
            && ("wsdl".equals(pArtifact.getType())
            || (
                    targetArtifact.getClassifier() != null
                            && pArtifact.getType() != null
                            && (targetArtifact.getClassifier() + ".wsdl").equals(pArtifact.getType())
            ));
}
 
Example 6
Source File: DependencyNodeUtil.java    From depgraph-maven-plugin with Apache License 2.0 5 votes vote down vote up
private static DependencyNode createConflict(Artifact artifact, String winningVersion) {
  org.eclipse.aether.artifact.DefaultArtifact aetherArtifact = new org.eclipse.aether.artifact.DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), artifact.getVersion());
  org.eclipse.aether.artifact.DefaultArtifact winnerArtifact = new org.eclipse.aether.artifact.DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), winningVersion);

  DefaultDependencyNode dependencyNode = new DefaultDependencyNode(new Dependency(aetherArtifact, artifact.getScope()));
  dependencyNode.setData(NODE_DATA_WINNER, new DefaultDependencyNode(new Dependency(winnerArtifact, "compile")));

  return new DependencyNode(dependencyNode);
}
 
Example 7
Source File: ExampleGraphMojo.java    From depgraph-maven-plugin with Apache License 2.0 5 votes vote down vote up
private static DependencyNode createConflict(Artifact artifact, String winningVersion) {
  org.eclipse.aether.artifact.DefaultArtifact aetherArtifact = new org.eclipse.aether.artifact.DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), artifact.getVersion());
  org.eclipse.aether.artifact.DefaultArtifact winnerArtifact = new org.eclipse.aether.artifact.DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getClassifier(), artifact.getType(), winningVersion);

  DefaultDependencyNode dependencyNode = new DefaultDependencyNode(new Dependency(aetherArtifact, artifact.getScope()));
  dependencyNode.setData(NODE_DATA_WINNER, new DefaultDependencyNode(new Dependency(winnerArtifact, "compile")));

  return new DependencyNode(dependencyNode);
}
 
Example 8
Source File: AjcHelper.java    From aspectj-maven-plugin with MIT License 5 votes vote down vote up
/**
 * Constructs AspectJ compiler classpath string
 *
 * @param project the Maven Project
 * @param pluginArtifacts the plugin Artifacts
 * @param outDirs the outputDirectories
 * @return a os spesific classpath string
 */
@SuppressWarnings( "unchecked" )
public static String createClassPath( MavenProject project, List<Artifact> pluginArtifacts, List<String> outDirs )
{
    String cp = new String();
    Set<Artifact> classPathElements = Collections.synchronizedSet( new LinkedHashSet<Artifact>() );
    Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts();
    classPathElements.addAll( dependencyArtifacts == null ? Collections.<Artifact>emptySet() : dependencyArtifacts );
    classPathElements.addAll( project.getArtifacts() );
    classPathElements.addAll( pluginArtifacts == null ? Collections.<Artifact>emptySet() : pluginArtifacts );
    for ( Artifact classPathElement  : classPathElements )
    {
        File artifact = classPathElement.getFile();
        if ( null != artifact )
        {
          String type = classPathElement.getType();
          if (!type.equals("pom")){
            cp += classPathElement.getFile().getAbsolutePath();
            cp += File.pathSeparatorChar;                
          }
        }
    }
    Iterator<String> outIter = outDirs.iterator();
    while ( outIter.hasNext() )
    {
        cp += outIter.next();
        cp += File.pathSeparatorChar;
    }

    if ( cp.endsWith( "" + File.pathSeparatorChar ) )
    {
        cp = cp.substring( 0, cp.length() - 1 );
    }

    cp = StringUtils.replace( cp, "//", "/" );
    return cp;
}
 
Example 9
Source File: DependenciesRenderer.java    From maven-confluence-plugin with Apache License 2.0 5 votes vote down vote up
private String[] getArtifactRow( Artifact artifact )
{
    return new String[] {
      		artifact.getGroupId(), 
      		artifact.getArtifactId(), 
      		artifact.getVersion(),
      		artifact.getClassifier(), 
      		artifact.getType(), 
      		artifact.isOptional() ? "(optional)" : " "
    			};
}
 
Example 10
Source File: AbstractMavenEventHandler.java    From pipeline-maven-plugin with MIT License 5 votes vote down vote up
public Xpp3Dom newElement(@Nonnull String name, @Nullable Artifact artifact) {
    Xpp3Dom element = new Xpp3Dom(name);
    if (artifact == null) {
        return element;
    }

    element.setAttribute("groupId", artifact.getGroupId());
    element.setAttribute("artifactId", artifact.getArtifactId());
    element.setAttribute("baseVersion", artifact.getBaseVersion());
    element.setAttribute("version", artifact.getVersion());
    element.setAttribute("snapshot", String.valueOf(artifact.isSnapshot()));
    if (artifact.getClassifier() != null) {
        element.setAttribute("classifier", artifact.getClassifier());
    }
    element.setAttribute("type", artifact.getType());
    element.setAttribute("id", artifact.getId());

    ArtifactHandler artifactHandler = artifact.getArtifactHandler();
    String extension;
    if (artifactHandler == null) {
        extension = artifact.getType();
    } else {
        extension = artifactHandler.getExtension();
    }
    element.setAttribute("extension", extension);

    return element;
}
 
Example 11
Source File: AbstractSwarmMojo.java    From thorntail with Apache License 2.0 5 votes vote down vote up
protected ArtifactSpec artifactToArtifactSpec(Artifact dep) {
    return new ArtifactSpec(dep.getScope(),
                            dep.getGroupId(),
                            dep.getArtifactId(),
                            dep.getBaseVersion(),
                            dep.getType(),
                            dep.getClassifier(),
                            dep.getFile());
}
 
Example 12
Source File: AbstractSwarmMojo.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
protected ArtifactSpec artifactToArtifactSpec(Artifact dep) {
    return new ArtifactSpec(dep.getScope(),
                            dep.getGroupId(),
                            dep.getArtifactId(),
                            dep.getBaseVersion(),
                            dep.getType(),
                            dep.getClassifier(),
                            dep.getFile());
}
 
Example 13
Source File: NativeLinkMojo.java    From maven-native with MIT License 4 votes vote down vote up
/**
 *
 */
private void attachPrimaryArtifact()
{
    Artifact artifact = this.project.getArtifact();

    if ( null == this.classifier )
    {
        artifact.setFile( new File( this.linkerOutputDirectory + "/" + this.project.getBuild().getFinalName() + "."
                + this.project.getArtifact().getArtifactHandler().getExtension() ) );
    }
    else
    {
        // install primary artifact as a classifier

        DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                artifact.getVersionRange().cloneOf(), artifact.getScope(), artifact.getType(), classifier,
                artifact.getArtifactHandler(), artifact.isOptional() );

        clone.setRelease( artifact.isRelease() );
        clone.setResolvedVersion( artifact.getVersion() );
        clone.setResolved( artifact.isResolved() );
        clone.setFile( artifact.getFile() );

        if ( artifact.getAvailableVersions() != null )
        {
            clone.setAvailableVersions( new ArrayList<>( artifact.getAvailableVersions() ) );
        }

        clone.setBaseVersion( artifact.getBaseVersion() );
        clone.setDependencyFilter( artifact.getDependencyFilter() );

        if ( artifact.getDependencyTrail() != null )
        {
            clone.setDependencyTrail( new ArrayList<>( artifact.getDependencyTrail() ) );
        }

        clone.setDownloadUrl( artifact.getDownloadUrl() );
        clone.setRepository( artifact.getRepository() );

        clone.setFile( new File( this.linkerOutputDirectory + "/" + this.project.getBuild().getFinalName() + "."
                + this.project.getArtifact().getArtifactHandler().getExtension() ) );

        project.setArtifact( clone );
    }
}
 
Example 14
Source File: LooseEarApplication.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
public String getModuleUri(Artifact artifact) throws Exception {
    String defaultUri = "/" + getModuleName(artifact);
    // both "jar" and "bundle" packaging type project are "jar" type dependencies
    // that will be packaged in the ear lib directory
    String type = artifact.getType();
    if (("jar".equals(type) || "bundle".equals(type)) && getEarDefaultLibBundleDir() != null) {
        defaultUri = "/" + getEarDefaultLibBundleDir() + defaultUri;
    }
    Xpp3Dom dom = project.getGoalConfiguration("org.apache.maven.plugins", "maven-ear-plugin", null, null);
    if (dom != null) {
        Xpp3Dom val = dom.getChild("modules");
        if (val != null) {
            Xpp3Dom[] modules = val.getChildren();
            if (modules != null) {
                for (int i = 0; i < modules.length; i++) {
                    if (artifact.getGroupId().equals(getConfigValue(modules[i].getChild("groupId")))
                            && artifact.getArtifactId().equals(getConfigValue(modules[i].getChild("artifactId")))) {
                        String uri = getConfigValue(modules[i].getChild("uri"));
                        if (uri != null) {
                            return uri;
                        } else {
                            String bundleDir = getConfigValue(modules[i].getChild("bundleDir"));
                            String bundleFileName = getConfigValue(modules[i].getChild("bundleFileName"));
                            if (bundleDir == null) {
                                if ("jar".equals(type) && getEarDefaultLibBundleDir() != null) {
                                    bundleDir = "/" + getEarDefaultLibBundleDir();
                                } else {
                                    bundleDir = "";
                                }
                            } else {
                                bundleDir = "/" + bundleDir;
                            }

                            // remove duplicate forward slashes. At this point, we know bundleDir starts
                            // with a slash or is empty
                            if (bundleDir.length() > 1 && bundleDir.charAt(0) == bundleDir.charAt(1)) {
                                StringBuilder sb = new StringBuilder(bundleDir);
                                do {
                                    sb.deleteCharAt(0);
                                } while (sb.length() > 1 && sb.charAt(0) == sb.charAt(1));
                                bundleDir = sb.toString();
                                if ("/".equals(bundleDir)) {
                                    bundleDir = "";
                                }
                            }
                            if (bundleFileName != null) {
                                return bundleDir + "/" + bundleFileName;
                            } else {
                                return bundleDir + "/" + getModuleName(artifact);
                            }
                        }
                    }
                }
            }
        }
    }
    return defaultUri;
}
 
Example 15
Source File: ScopeFilter.java    From sundrio with Apache License 2.0 4 votes vote down vote up
public Artifact apply(Artifact artifact) {
    return artifact == null ? null : new DefaultArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope() != null ? artifact.getScope() : Artifact.SCOPE_COMPILE, artifact.getType(), artifact.getClassifier(), artifact.getArtifactHandler());
}
 
Example 16
Source File: AbstractJnlpMojo.java    From webstart with MIT License 4 votes vote down vote up
private void processDependency( Artifact artifact )
        throws MojoExecutionException
{
    // TODO: scope handler
    // Include runtime and compile time libraries
    if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) &&
            !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) &&
            !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
    {
        String type = artifact.getType();
        if ( "jar".equals( type ) || "ejb-client".equals( type ) )
        {

            boolean mainArtifact = false;
            if ( jnlp.isRequireMainClass() )
            {

                // try to find if this dependency contains the main class
                boolean containsMainClass =
                        getArtifactUtil().artifactContainsClass( artifact, jnlp.getMainClass() );

                if ( containsMainClass )
                {
                    if ( artifactWithMainClass == null )
                    {
                        mainArtifact = true;
                        artifactWithMainClass = artifact;
                        getLog().debug(
                                "Found main jar. Artifact " + artifactWithMainClass + " contains the main class: " +
                                        jnlp.getMainClass() );
                    }
                    else
                    {
                        getLog().warn(
                                "artifact " + artifact + " also contains the main class: " + jnlp.getMainClass() +
                                        ". IGNORED." );
                    }
                }
            }

            if ( skipDependencies && !mainArtifact )
            {
                return;
            }

            // FIXME when signed, we should update the manifest.
            // see http://www.mail-archive.com/[email protected]/msg08081.html
            // and maven1: maven-plugins/jnlp/src/main/org/apache/maven/jnlp/UpdateManifest.java
            // or shouldn't we?  See MOJO-7 comment end of October.
            final File toCopy = artifact.getFile();

            if ( toCopy == null )
            {
                getLog().error( "artifact with no file: " + artifact );
                getLog().error( "artifact download url: " + artifact.getDownloadUrl() );
                getLog().error( "artifact repository: " + artifact.getRepository() );
                getLog().error( "artifact repository: " + artifact.getVersion() );
                throw new IllegalStateException(
                        "artifact " + artifact + " has no matching file, why? Check the logs..." );
            }

            String name =
                    getDependencyFilenameStrategy().getDependencyFilename( artifact, outputJarVersions, isUseUniqueVersions() );

            boolean copied = copyJarAsUnprocessedToDirectoryIfNecessary( toCopy, getLibDirectory(), name );

            if ( copied )
            {

                getModifiedJnlpArtifacts().add( name.substring( 0, name.lastIndexOf( '.' ) ) );

            }

            packagedJnlpArtifacts.add( artifact );

        }
        else
        // FIXME how do we deal with native libs?
        // we should probably identify them and package inside jars that we timestamp like the native lib
        // to avoid repackaging every time. What are the types of the native libs?
        {
            verboseLog( "Skipping artifact of type " + type + " for " + getLibDirectory().getName() );
        }
        // END COPY
    }
    else
    {
        verboseLog( "Skipping artifact of scope " + artifact.getScope() + " for " + getLibDirectory().getName() );
    }
}
 
Example 17
Source File: AbstractJnlpMojo.java    From webstart with MIT License 4 votes vote down vote up
private void processExtensionDependency( JnlpExtension extension, Artifact artifact )
        throws MojoExecutionException
{
    // TODO: scope handler
    // Include runtime and compile time libraries
    if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) &&
            !Artifact.SCOPE_PROVIDED.equals( artifact.getScope() ) &&
            !Artifact.SCOPE_TEST.equals( artifact.getScope() ) )
    {
        String type = artifact.getType();
        if ( "jar".equals( type ) || "ejb-client".equals( type ) )
        {

            // FIXME when signed, we should update the manifest.
            // see http://www.mail-archive.com/[email protected]/msg08081.html
            // and maven1: maven-plugins/jnlp/src/main/org/apache/maven/jnlp/UpdateManifest.java
            // or shouldn't we?  See MOJO-7 comment end of October.
            final File toCopy = artifact.getFile();

            if ( toCopy == null )
            {
                getLog().error( "artifact with no file: " + artifact );
                getLog().error( "artifact download url: " + artifact.getDownloadUrl() );
                getLog().error( "artifact repository: " + artifact.getRepository() );
                getLog().error( "artifact repository: " + artifact.getVersion() );
                throw new IllegalStateException(
                        "artifact " + artifact + " has no matching file, why? Check the logs..." );
            }

            // check jar is signed
            boolean jarSigned = isJarSigned( toCopy );
            if ( !jarSigned )
            {
                throw new IllegalStateException(
                        "artifact " + artifact + " must be signed as part of an extension.." );
            }

            String targetFilename =
                    getDependencyFilenameStrategy().getDependencyFilename( artifact, outputJarVersions, isUseUniqueVersions() );

            File targetFile = new File( getLibDirectory(), targetFilename );
            boolean copied = getIoUtil().shouldCopyFile( toCopy, targetFile );

            if ( copied )
            {
                getIoUtil().copyFile( toCopy, targetFile );
                verboseLog( "copy extension artifact " + toCopy );
            }
            else
            {
                verboseLog( "already up to date artifact " + toCopy );
            }

            // save the artifact dependency for the extension

            List<Artifact> deps = extensionsJnlpArtifacts.get( extension );
            if ( deps == null )
            {
                deps = new ArrayList<>();
                extensionsJnlpArtifacts.put( extension, deps );
            }
            deps.add( artifact );
        }
        else
        // FIXME how do we deal with native libs?
        // we should probably identify them and package inside jars that we timestamp like the native lib
        // to avoid repackaging every time. What are the types of the native libs?
        {
            verboseLog( "Skipping artifact of type " + type + " for " + getLibDirectory().getName() );
        }
        // END COPY
    }
    else
    {
        verboseLog( "Skipping artifact of scope " + artifact.getScope() + " for " + getLibDirectory().getName() );
    }
}
 
Example 18
Source File: DeployMojoSupport.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
protected void installLooseConfigEar(MavenProject proj, LooseConfigData config) throws Exception {
    LooseEarApplication looseEar = new LooseEarApplication(proj, config);
    looseEar.addSourceDir();
    looseEar.addApplicationXmlFile();

    Set<Artifact> artifacts = proj.getArtifacts();
    log.debug("Number of compile dependencies for " + proj.getArtifactId() + " : " + artifacts.size());

    for (Artifact artifact : artifacts) {
        if ("compile".equals(artifact.getScope()) || "runtime".equals(artifact.getScope())) {
            if (!isReactorMavenProject(artifact)) {
                if (looseEar.isEarSkinnyWars() && "war".equals(artifact.getType())) {
                    throw new MojoExecutionException(
                            "Unable to create loose configuration for the EAR application with skinnyWars package from "
                                    + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
                                    + artifact.getVersion()
                                    + ". Please set the looseApplication configuration parameter to false and try again.");
                }
                looseEar.addModuleFromM2(resolveArtifact(artifact));
            } else {
                MavenProject dependencyProject = getReactorMavenProject(artifact);
                switch (artifact.getType()) {
                case "jar":
                    looseEar.addJarModule(dependencyProject);
                    break;
                case "ejb":
                    looseEar.addEjbModule(dependencyProject);
                    break;
                case "war":
                    Element warArchive = looseEar.addWarModule(dependencyProject,
                            getWarSourceDirectory(dependencyProject));
                    if (looseEar.isEarSkinnyWars()) {
                        // add embedded lib only if they are not a compile dependency in the ear
                        // project.
                        addSkinnyWarLib(warArchive, dependencyProject, looseEar);
                    } else {
                        addEmbeddedLib(warArchive, dependencyProject, looseEar, "/WEB-INF/lib/");
                    }
                    break;
                case "rar":
                    Element rarArchive = looseEar.addRarModule(dependencyProject);
                    addEmbeddedLib(rarArchive, dependencyProject, looseEar, "/");
                    break;
                default:
                    // use the artifact from local .m2 repo
                    looseEar.addModuleFromM2(resolveArtifact(artifact));
                    break;
                }
            }
        }
    }

    // add Manifest file
    File manifestFile = MavenProjectUtil.getManifestFile(proj, "maven-ear-plugin");
    looseEar.addManifestFile(manifestFile);
}
 
Example 19
Source File: BaratineMojo.java    From baratine with GNU General Public License v2.0 4 votes vote down vote up
public File createBar()
  throws MojoExecutionException
{
  File bar = getBarFile();

  MavenArchiver archiver = new MavenArchiver();

  archiver.setArchiver(this.archiver);

  archiver.setOutputFile(bar);

  try {
    File web = getWebDirectory();

    if (web.exists())
      this.archiver.addDirectory(web, this.web);

    File contentDirectory = getClassesDirectory();

    this.archiver.addDirectory(contentDirectory,
                               "classes/",
                               getIncludes(),
                               getExcludes());

    String baratineMetaName = "META-INF"
                              + File.separatorChar
                              + "baratine";

    File baratineMeta = new File(contentDirectory, baratineMetaName);

    if (baratineMeta.exists())
      this.archiver.addDirectory(baratineMeta,
                                 baratineMetaName
                                 + File.separatorChar);

    for (Object x : project.getArtifacts()) {
      Artifact artifact = (Artifact) x;

      final String type = artifact.getType();

      if ("js".equals(type)) {
        addJs(artifact);
      }
      else if ("jar".equals(type)) {
        addJar(artifact);
      }
      else {
        getLog().info("skipping artifact "
                      + artifact.getId()
                      + ':'
                      + artifact.getArtifactId()
                      + ':'
                      + artifact.getSelectedVersion()
                      + ':' + artifact.getType());
      }

    }

    archiver.createArchive(session, project, archive);

    return bar;
  } catch (Exception e) {
    throw new MojoExecutionException("Error assembling bar", e);
  }
}
 
Example 20
Source File: Util.java    From jax-maven-plugin with Apache License 2.0 4 votes vote down vote up
private static String string(Artifact a) {
    return a.getGroupId() + ":" + a.getArtifactId() + ":" + a.getVersion() + ":" + a.getScope() + ":" + a.getType();
}