Hello,

The dependencies of a project may be passed to a plugin by declaring it as
an annotation.  For example, in your case, you could do:

    /**
     * The project dependencies.
     * @parameter expression="${project.dependencies}"

     */
    private List dependencies;



The List will hold the project's dependencies (class Dependency) from which
you can access the scope using Dependency.getScope().

I hope it helps.


Cheers!
Nap

On 1/11/06, Steve Kuo <[EMAIL PROTECTED] > wrote:
>
> I have a need to iterate through the dependencies in pom.xml.  I created
> a plugin and tried to passed ${dependencies} in pom.xml as a parameter
> to the plugin.  Unfortunately, ${dependencies} is passed in as a String
> instead of a List of objects.  How does one do that?  Also, is there a
> way to print out the scope for each dependency?  I like to use it to
> remove jars used only in testing.
>
> Below is a portion of pom.xml and the mvn package run.
>
> {pom.xml}
>
>       <plugin>
>         <groupId>ehcomponents</groupId>
>         <artifactId>maven-classpath-plugin</artifactId>
>         <configuration>
>           <dependencies>${dependencies}</dependencies>
>         </configuration>
>         <executions>
>           <execution>
>             <phase>package</phase>
>             <goals>
>               <goal>classpath</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
> {output of mvn package}
>
> [INFO] [jar:jar]
> [INFO] Building jar: /home/skuo/sandbox/mvnApp/mvnJar/target/mvnJar-1.0-
> SNAPSHOT.jar
> [INFO] [classpath:classpath {execution: default}]
> [INFO] Generating classpath.sh
> [INFO] dependencies: [Dependency {groupId=junit, artifactId=junit,
> version=3.8.1, type=jar}, Dependency {groupId=mx4j, artifactId=mx4j,
> version=3.0.1, type=jar}]
>
>
> --
> Steve Kuo
> eHarmony
> 300 N. Lake Ave., Suite 1111
> Pasadena, CA 91101
> [EMAIL PROTECTED]
> 626.795.4814, x-1021
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to