Examples of Artifact


Examples of org.apache.maven.artifact.Artifact

            // Not sure why this doesn't get all the dependencies, so I'll add them manually
           
            Set artifactsSet = project.getDependencyArtifacts();
            for (Iterator i = artifactsSet.iterator(); i.hasNext(); )
            {
                Artifact a = (Artifact) i.next();
                {
                    // if ( Artifact.SCOPE_TEST.equals( a.getScope() )  // Test scope = all.
                    {
                        File file = a.getFile();
                        if ( file == null )
                        {
                            throw new DependencyResolutionRequiredException( a );
                        }
                        set.add( file.getPath() );
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

 
      list.add( project.getBuild().getOutputDirectory() );
 
      for ( Iterator i = project.getDependencyArtifacts().iterator(); i.hasNext(); )
      {
          Artifact a = (Artifact) i.next();
 
          if ( a.getArtifactHandler().isAddedToClasspath() )
          {
              // TODO: let the scope handler deal with this
              if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) ||
                  Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
              {
                  String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId() );
                  MavenProject project = (MavenProject) this.project.getProjectReferences().get( refId );
                  if ( project != null )
                  {
                      list.add( project.getBuild().getOutputDirectory() );
                  }
                  else
                  {
                      File file = a.getFile();
                      if ( file == null )
                      {
                          throw new DependencyResolutionRequiredException( a );
                      }
                      list.add( file.getPath() );
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

        getLog().info("OutputDirectory: " + outputDirectory);
        outputDirectory.mkdirs();
       
        for (Iterator itr = project.getArtifacts().iterator(); itr.hasNext();)
        {
            Artifact a = (Artifact) itr.next();

            if (a.getArtifactId().startsWith("xfire-") && !excludeList.contains(a.getArtifactId()))
            {
                getLog().info("Found " + a.getArtifactId());
               
                try
                {
                    unpack( a.getFile(), outputDirectory );
                }
                catch (MojoExecutionException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

            // Not sure why this doesn't get all the dependencies, so I'll add them manually
           
            Set artifactsSet = project.getDependencyArtifacts();
            for (Iterator i = artifactsSet.iterator(); i.hasNext(); )
            {
                Artifact a = (Artifact) i.next();
                {
                    // if ( Artifact.SCOPE_TEST.equals( a.getScope() )  // Test scope = all.
                    {
                        File file = a.getFile();
                        if ( file == null )
                        {
                            throw new DependencyResolutionRequiredException( a );
                        }
                        set.add( file.getPath() );
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

            dependency.setScope(Artifact.SCOPE_RUNTIME);
            this.project.getDependencies().add(dependency);
        }
        for (final Iterator iterator = this.project.getTestArtifacts().iterator(); iterator.hasNext();)
        {
            final Artifact artifact = (Artifact)iterator.next();
            artifact.setScope(Artifact.SCOPE_RUNTIME);
            this.project.getArtifacts().add(artifact);
        }
    }
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

     */
    protected void addDependency(final Dependency dependency)
    {
        if (dependency != null)
        {
            final Artifact artifact =
                this.factory.createArtifact(
                    dependency.getGroupId(),
                    dependency.getArtifactId(),
                    dependency.getVersion(),
                    dependency.getScope(),
                    dependency.getType());
            final File file = new File(
                    this.localRepository.getBasedir(),
                    this.localRepository.pathOf(artifact));
            artifact.setFile(file);
            this.project.getDependencies().add(dependency);
            this.project.getArtifacts().add(artifact);
        }
    }
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

                    }
                }
            }

            final File xmlZipFile = new File(buildDirectory, this.finalName + ".xml.zip");
            final Artifact artifact = this.project.getArtifact();
            artifact.setFile(xmlZipFile);
            if (this.generateJar)
            {
                final File workDirectory = new File(this.workDirectory);
                this.getLog().info("Building model jar " + finalName);

                final Artifact jarArtifact =
                    artifactFactory.createArtifact(
                        project.getGroupId(),
                        project.getArtifactId(),
                        project.getVersion(),
                        null,
                        ATTACHED_ARTIFACT_TYPE);

                File modelJar = new File(workDirectory, finalName + "." + ATTACHED_ARTIFACT_TYPE);

                final MavenArchiver modelJarArchiver = new MavenArchiver();

                modelJarArchiver.setArchiver(this.modelJarArchiver);
                modelJarArchiver.setOutputFile(modelJar);
                modelJarArchiver.getArchiver().addDirectory(
                    new File(this.outputDirectory),
                    JAR_INCLUDES,
                    JAR_EXCLUDES);

                // - create archive
                modelJarArchiver.createArchive(
                    project,
                    archive);

                // - set the artifact file as the modelJar so that we can install the model jar
                jarArtifact.setFile(modelJar);
                this.installModelJar(
                    jarArtifact,
                    modelJar);
                projectHelper.attachArtifact(
                    project,
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

            if (artifacts != null)
            {
                for (int ctr = 0; ctr < artifacts.length; ctr++)
                {
                    final CartridgeArtifact cartridgeArtifact = artifacts[ctr];
                    final Artifact artifact = this.resolveArtifact(cartridgeArtifact);
                    if (artifact != null)
                    {
                        final String path = cartridgeArtifact.getPath();
                        if (path == null || path.trim().length() == 0)
                        {
                            throw new MojoFailureException("Please specify the 'path' for the cartridge artifact [" +
                                cartridgeArtifact.getGroupId() + ":" + cartridgeArtifact.getArtifactId() + ":" +
                                cartridgeArtifact.getType() + "]");
                        }

                        final File destinationDirectory = new File(outputDirectory,
                                cartridgeArtifact.getPath());
                        final File artifactFile = artifact.getFile();
                        final String artifactPath =
                            artifactFile != null
                            ? StringUtils.replace(
                                artifact.getFile().toString().replaceAll(
                                    ".*(\\\\|/)",
                                    ""),
                                '-' + artifact.getVersion(),
                                "") : null;
                        if (artifactPath != null)
                        {
                            FileUtils.copyFile(
                                artifactFile,
                                new File(
                                    destinationDirectory,
                                    artifactPath));
                        }
                    }
                }
            }
            final File cartridgeFile = new File(buildDirectory, this.finalName + ".jar");
            final Artifact artifact = this.project.getArtifact();
            final MavenArchiver archiver = new MavenArchiver();
            archiver.setArchiver(this.jarArchiver);
            archiver.setOutputFile(cartridgeFile);
            archiver.getArchiver().addDirectory(
                outputDirectory,
                OUTPUT_INCLUDES,
                null);
            archiver.createArchive(
                this.project,
                this.archive);
            artifact.setFile(cartridgeFile);
        }
        catch (final Throwable throwable)
        {
            throw new MojoExecutionException("An error occured while packaging this cartridge", throwable);
        }
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

     * @throws MojoFailureException
     */
    public Artifact resolveArtifact(final CartridgeArtifact cartridgeArtifact)
        throws MojoFailureException
    {
        Artifact resolvedArtifact = null;
        if (cartridgeArtifact != null)
        {
            final Collection artifacts = this.project.getArtifacts();
            final String groupId = cartridgeArtifact.getGroupId();
            final String artifactId = cartridgeArtifact.getArtifactId();
            final String type = cartridgeArtifact.getType();
            if (groupId == null || artifactId == null)
            {
                throw new MojoFailureException("Could not resolve cartridge artifact [" + groupId + ":" + artifactId +
                    ":" + type + "]");
            }

            for (final Iterator iterator = artifacts.iterator(); iterator.hasNext();)
            {
                final Artifact artifact = (Artifact)iterator.next();
                if (artifact.getGroupId().equals(groupId) && artifact.getArtifactId().equals(artifactId) &&
                    (type == null || artifact.getType().equals(type)))
                {
                    resolvedArtifact = artifact;
                    break;
                }
            }
View Full Code Here

Examples of org.apache.maven.artifact.Artifact

                }
            }

            final File uml2File = new File(buildDirectory, this.finalName + ".uml2");

            final Artifact artifact = this.project.getArtifact();

            // - set the artifact file back to the correct file (since we've installed modelJar already)
            artifact.setFile(uml2File);
        }
        catch (final Throwable throwable)
        {
            throw new MojoExecutionException("Error assembling model", throwable);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.