Changeset 7896


Ignore:
Timestamp:
02/24/12 10:27:24 (8 years ago)
Author:
melissa
Message:

Fix cppwrap-maven-plugin to work with Maven 3

We now iterate over all of the artifacts attached to a project, and include
them in the list of JARs to be added to the CLASSPATH.

Unfortunately, for this to fully work we need a couple of extra transitive
dependencies in the POM. There may be a better place to put these, but for now
it works.

Location:
trunk/projects/cppwrap-maven-plugin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/cppwrap-maven-plugin/pom.xml

    r7730 r7896  
    4848      <artifactId>maven-project</artifactId> 
    4949      <version>${maven.version}</version> 
     50    </dependency> 
     51 
     52    <!-- FIXME: Eliminate these transitive dependencies.  Required for Maven 3 support. --> 
     53    <dependency> 
     54      <groupId>org.apache.velocity</groupId> 
     55      <artifactId>velocity</artifactId> 
     56      <version>1.6.4</version> 
     57    </dependency> 
     58    <dependency> 
     59      <groupId>jace</groupId> 
     60      <artifactId>jace</artifactId> 
     61      <version>r61</version> 
    5062    </dependency> 
    5163  </dependencies> 
  • trunk/projects/cppwrap-maven-plugin/src/main/java/loci/maven/plugin/cppwrap/CppWrapMojo.java

    r7882 r7896  
    3838import java.io.IOException; 
    3939import java.util.ArrayList; 
     40import java.util.Arrays; 
    4041import java.util.Collections; 
    4142import java.util.Comparator; 
    4243import java.util.List; 
    43 import java.util.Arrays; 
    4444 
    4545import loci.jar2lib.Jar2Lib; 
     
    192192                final List<String> jars = new ArrayList<String>(); 
    193193 
    194                 // add project artifact 
    195                 // TODO: Try project.getArtifacts()? 
    196                 final File projectArtifact = project.getArtifact().getFile(); 
    197                 if (projectArtifact == null || !projectArtifact.exists()) { 
    198                         throw new MojoExecutionException( 
    199                                 "Must execute package target first (e.g., mvn package cppwrap:wrap)."); 
    200                 } 
    201                 jars.add(projectArtifact.getPath()); 
     194                // add project artifacts 
     195                List<Artifact> allArtifacts = project.getAttachedArtifacts(); 
     196                for (Artifact artifact : allArtifacts) { 
     197                        final File projectArtifact = artifact.getFile(); 
     198                        if (projectArtifact == null || !projectArtifact.exists()) { 
     199                                throw new MojoExecutionException("Must execute package target first " + 
     200                                        "(e.g., mvn package cppwrap:wrap)."); 
     201                        } 
     202                        jars.add(projectArtifact.getPath()); 
     203                } 
    202204 
    203205                // add explicitly enumerated dependencies 
Note: See TracChangeset for help on using the changeset viewer.