You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ryan Moquin <fr...@gmail.com> on 2009/01/07 19:16:55 UTC

maven-dependency-plugin copy-dependencies

I'm trying to understand how to use the copy-dependencies goal for the
maven-dependency-plugin.  Basically I want to just copy a few dependencies
that are important to a directory, and exclude the rest.  For some reason, I
can't seem to get any of the filters to work, here is an example of the
plugin definition that gives me trouble:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <excludeTypes>zip</excludeTypes>
              <includeTypes>jar</includeTypes>
              <failOnWarning>true</failOnWarning>

<outputDirectory>${project.build.directory}/standalone</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
          </execution>
        </executions>
      </plugin>

If I use the above plugin definition and have dependencies of jar and zip
types, when I run:

mvn clean dependency:copy-dependencies

I will get all the dependencies to show up in my standalone directory,
whether or not they are of type jar or zip.  According to the documentation,
this is how you would do it, but no combination of filtering I've tried has
seemed to work.  Am I doing something wrong?  I'm using version 2.0.9.
Thanks for any help!!

Ryan

Re: maven-dependency-plugin copy-dependencies

Posted by Ryan Moquin <fr...@gmail.com>.
Sorry, I forgot this is a "reply all list".

I thought that the part before the colon could be considered a phase.  I
guess I shouldn't assume.that.

I tried it that way and didn't think it worked, but I'll give it another
shot in case when trying the different combinations I didn't try that one
like I thought I did.

Thanks,
Ryan

On Thu, Jan 8, 2009 at 9:37 AM, Jeff MAURY <je...@jeffmaury.com> wrote:

> I don't think because dependency is not a Maven standard phase !!!
> I suggest that you modify your POM so that the configuration parameters are
> independent of the phase and goals:
>
> <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-dependency-plugin</artifactId>
>             <configuration>
>               <excludeTypes>zip</excludeTypes>
>               <includeTypes>jar</includeTypes>
>               <failOnWarning>true</failOnWarning>
>
>   <outputDirectory>${project.build.directory}/standalone</outputDirectory>
>               <overWriteReleases>false</overWriteReleases>
>               <overWriteSnapshots>false</overWriteSnapshots>
>               <overWriteIfNewer>true</overWriteIfNewer>
>             </configuration>
>       </plugin>
>
>
> Jeff MAURY
>
>
> On Thu, Jan 8, 2009 at 3:30 PM, Ryan Moquin <fr...@gmail.com>wrote:
>
>> That's what I figured, I couldn't see how it would work this way, I think
>> this page made me think that you would use dependency:copy-dependencies to
>> invoke it:
>>
>>
>> http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html
>>
>> So, if I changed it to dependency, rather than package, should it work?  I
>> tried that way (which is what I assume should be the correct way), but it
>> doesn't seem to work.  I don't want it bound to the package phase, I wanted
>> to execute that goal by itself.
>>
>> Thanks!
>> Ryan
>>
>>
>> On Thu, Jan 8, 2009 at 4:32 AM, Jeff MAURY <je...@gmail.com> wrote:
>>
>>> Because you bound it to the phase package, you should use mvn clean
>>> package
>>> instead. I think Maven will not pick up your configuration if your run
>>> mvn
>>> clean dependency:copy-dependencies
>>>
>>> Regards
>>> Jeff
>>>
>>>
>>> On Wed, Jan 7, 2009 at 7:16 PM, Ryan Moquin <fr...@gmail.com>
>>> wrote:
>>>
>>> > I'm trying to understand how to use the copy-dependencies goal for the
>>> > maven-dependency-plugin.  Basically I want to just copy a few
>>> dependencies
>>> > that are important to a directory, and exclude the rest.  For some
>>> reason,
>>> > I
>>> > can't seem to get any of the filters to work, here is an example of the
>>> > plugin definition that gives me trouble:
>>> >
>>> > <plugin>
>>> >        <groupId>org.apache.maven.plugins</groupId>
>>> >        <artifactId>maven-dependency-plugin</artifactId>
>>> >        <executions>
>>> >          <execution>
>>> >            <id>copy-dependencies</id>
>>> >            <phase>package</phase>
>>> >            <goals>
>>> >              <goal>copy-dependencies</goal>
>>> >            </goals>
>>> >            <configuration>
>>> >              <excludeTypes>zip</excludeTypes>
>>> >              <includeTypes>jar</includeTypes>
>>> >              <failOnWarning>true</failOnWarning>
>>> >
>>> >
>>> <outputDirectory>${project.build.directory}/standalone</outputDirectory>
>>> >              <overWriteReleases>false</overWriteReleases>
>>> >              <overWriteSnapshots>false</overWriteSnapshots>
>>> >              <overWriteIfNewer>true</overWriteIfNewer>
>>> >            </configuration>
>>> >          </execution>
>>> >        </executions>
>>> >      </plugin>
>>> >
>>> > If I use the above plugin definition and have dependencies of jar and
>>> zip
>>> > types, when I run:
>>> >
>>> > mvn clean dependency:copy-dependencies
>>> >
>>> > I will get all the dependencies to show up in my standalone directory,
>>> > whether or not they are of type jar or zip.  According to the
>>> > documentation,
>>> > this is how you would do it, but no combination of filtering I've tried
>>> has
>>> > seemed to work.  Am I doing something wrong?  I'm using version 2.0.9.
>>> > Thanks for any help!!
>>> >
>>> > Ryan
>>> >
>>>
>>>
>>>
>>> --
>>> La mélancolie c'est communiste
>>> Tout le monde y a droit de temps en temps
>>> La mélancolie n'est pas capitaliste
>>> C'est même gratuit pour les perdants
>>> La mélancolie c'est pacifiste
>>> On ne lui rentre jamais dedans
>>> La mélancolie oh tu sais ça existe
>>> Elle se prend même avec des gants
>>> La mélancolie c'est pour les syndicalistes
>>> Il faut juste sa carte de permanent
>>>
>>> Miossec (2006)
>>>
>>> http://www.jeffmaury.com
>>> http://riadiscuss.jeffmaury.com
>>> http://www.lastfm.fr/listen/user/jeffmaury/personal
>>> Mes CDs à récupérer:
>>> http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
>>>
>>
>>
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
> http://www.lastfm.fr/listen/user/jeffmaury/personal
> Mes CDs à récupérer:
> http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
>

Re: maven-dependency-plugin copy-dependencies

Posted by Jeff MAURY <je...@jeffmaury.com>.
I don't think because dependency is not a Maven standard phase !!!
I suggest that you modify your POM so that the configuration parameters are
independent of the phase and goals:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
            <configuration>
              <excludeTypes>zip</excludeTypes>
              <includeTypes>jar</includeTypes>
              <failOnWarning>true</failOnWarning>

  <outputDirectory>${project.build.directory}/standalone</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>false</overWriteSnapshots>
              <overWriteIfNewer>true</overWriteIfNewer>
            </configuration>
      </plugin>


Jeff MAURY

On Thu, Jan 8, 2009 at 3:30 PM, Ryan Moquin <fr...@gmail.com> wrote:

> That's what I figured, I couldn't see how it would work this way, I think
> this page made me think that you would use dependency:copy-dependencies to
> invoke it:
>
>
> http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html
>
> So, if I changed it to dependency, rather than package, should it work?  I
> tried that way (which is what I assume should be the correct way), but it
> doesn't seem to work.  I don't want it bound to the package phase, I wanted
> to execute that goal by itself.
>
> Thanks!
> Ryan
>
>
> On Thu, Jan 8, 2009 at 4:32 AM, Jeff MAURY <je...@gmail.com> wrote:
>
>> Because you bound it to the phase package, you should use mvn clean
>> package
>> instead. I think Maven will not pick up your configuration if your run mvn
>> clean dependency:copy-dependencies
>>
>> Regards
>> Jeff
>>
>>
>> On Wed, Jan 7, 2009 at 7:16 PM, Ryan Moquin <fr...@gmail.com>
>> wrote:
>>
>> > I'm trying to understand how to use the copy-dependencies goal for the
>> > maven-dependency-plugin.  Basically I want to just copy a few
>> dependencies
>> > that are important to a directory, and exclude the rest.  For some
>> reason,
>> > I
>> > can't seem to get any of the filters to work, here is an example of the
>> > plugin definition that gives me trouble:
>> >
>> > <plugin>
>> >        <groupId>org.apache.maven.plugins</groupId>
>> >        <artifactId>maven-dependency-plugin</artifactId>
>> >        <executions>
>> >          <execution>
>> >            <id>copy-dependencies</id>
>> >            <phase>package</phase>
>> >            <goals>
>> >              <goal>copy-dependencies</goal>
>> >            </goals>
>> >            <configuration>
>> >              <excludeTypes>zip</excludeTypes>
>> >              <includeTypes>jar</includeTypes>
>> >              <failOnWarning>true</failOnWarning>
>> >
>> > <outputDirectory>${project.build.directory}/standalone</outputDirectory>
>> >              <overWriteReleases>false</overWriteReleases>
>> >              <overWriteSnapshots>false</overWriteSnapshots>
>> >              <overWriteIfNewer>true</overWriteIfNewer>
>> >            </configuration>
>> >          </execution>
>> >        </executions>
>> >      </plugin>
>> >
>> > If I use the above plugin definition and have dependencies of jar and
>> zip
>> > types, when I run:
>> >
>> > mvn clean dependency:copy-dependencies
>> >
>> > I will get all the dependencies to show up in my standalone directory,
>> > whether or not they are of type jar or zip.  According to the
>> > documentation,
>> > this is how you would do it, but no combination of filtering I've tried
>> has
>> > seemed to work.  Am I doing something wrong?  I'm using version 2.0.9.
>> > Thanks for any help!!
>> >
>> > Ryan
>> >
>>
>>
>>
>> --
>> La mélancolie c'est communiste
>> Tout le monde y a droit de temps en temps
>> La mélancolie n'est pas capitaliste
>> C'est même gratuit pour les perdants
>> La mélancolie c'est pacifiste
>> On ne lui rentre jamais dedans
>> La mélancolie oh tu sais ça existe
>> Elle se prend même avec des gants
>> La mélancolie c'est pour les syndicalistes
>> Il faut juste sa carte de permanent
>>
>> Miossec (2006)
>>
>> http://www.jeffmaury.com
>> http://riadiscuss.jeffmaury.com
>> http://www.lastfm.fr/listen/user/jeffmaury/personal
>> Mes CDs à récupérer:
>> http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
>>
>
>


-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.lastfm.fr/listen/user/jeffmaury/personal
Mes CDs à récupérer:
http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en

Re: maven-dependency-plugin copy-dependencies

Posted by Ryan Moquin <fr...@gmail.com>.
That's what I figured, I couldn't see how it would work this way, I think
this page made me think that you would use dependency:copy-dependencies to
invoke it:

http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html

So, if I changed it to dependency, rather than package, should it work?  I
tried that way (which is what I assume should be the correct way), but it
doesn't seem to work.  I don't want it bound to the package phase, I wanted
to execute that goal by itself.

Thanks!
Ryan

On Thu, Jan 8, 2009 at 4:32 AM, Jeff MAURY <je...@gmail.com> wrote:

> Because you bound it to the phase package, you should use mvn clean package
> instead. I think Maven will not pick up your configuration if your run mvn
> clean dependency:copy-dependencies
>
> Regards
> Jeff
>
>
> On Wed, Jan 7, 2009 at 7:16 PM, Ryan Moquin <fr...@gmail.com>
> wrote:
>
> > I'm trying to understand how to use the copy-dependencies goal for the
> > maven-dependency-plugin.  Basically I want to just copy a few
> dependencies
> > that are important to a directory, and exclude the rest.  For some
> reason,
> > I
> > can't seem to get any of the filters to work, here is an example of the
> > plugin definition that gives me trouble:
> >
> > <plugin>
> >        <groupId>org.apache.maven.plugins</groupId>
> >        <artifactId>maven-dependency-plugin</artifactId>
> >        <executions>
> >          <execution>
> >            <id>copy-dependencies</id>
> >            <phase>package</phase>
> >            <goals>
> >              <goal>copy-dependencies</goal>
> >            </goals>
> >            <configuration>
> >              <excludeTypes>zip</excludeTypes>
> >              <includeTypes>jar</includeTypes>
> >              <failOnWarning>true</failOnWarning>
> >
> > <outputDirectory>${project.build.directory}/standalone</outputDirectory>
> >              <overWriteReleases>false</overWriteReleases>
> >              <overWriteSnapshots>false</overWriteSnapshots>
> >              <overWriteIfNewer>true</overWriteIfNewer>
> >            </configuration>
> >          </execution>
> >        </executions>
> >      </plugin>
> >
> > If I use the above plugin definition and have dependencies of jar and zip
> > types, when I run:
> >
> > mvn clean dependency:copy-dependencies
> >
> > I will get all the dependencies to show up in my standalone directory,
> > whether or not they are of type jar or zip.  According to the
> > documentation,
> > this is how you would do it, but no combination of filtering I've tried
> has
> > seemed to work.  Am I doing something wrong?  I'm using version 2.0.9.
> > Thanks for any help!!
> >
> > Ryan
> >
>
>
>
> --
> La mélancolie c'est communiste
> Tout le monde y a droit de temps en temps
> La mélancolie n'est pas capitaliste
> C'est même gratuit pour les perdants
> La mélancolie c'est pacifiste
> On ne lui rentre jamais dedans
> La mélancolie oh tu sais ça existe
> Elle se prend même avec des gants
> La mélancolie c'est pour les syndicalistes
> Il faut juste sa carte de permanent
>
> Miossec (2006)
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
> http://www.lastfm.fr/listen/user/jeffmaury/personal
> Mes CDs à récupérer:
> http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en
>

RE: maven-dependency-plugin copy-dependencies

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Nope, it's the same as this: http://maven.apache.org/plugins/maven-dependency-plugin/faq.html#cli

If you put the config in an execution, that config is not picked up when you run from the cli. If you want to bind it to a phase to run as part of the lifecycle, then it will work fine. If you want it from the cli also, then put the config outside of an execution block and it will also work. This is a maven core issue in how the command line invocations essentially have no execution associated with them. If you use -X on the command line, you can see the values being injected into the mojo.

-----Original Message-----
From: Jeff MAURY [mailto:jeffmaury@gmail.com] 
Sent: Thursday, January 08, 2009 4:33 AM
To: Maven Users List
Subject: Re: maven-dependency-plugin copy-dependencies

Because you bound it to the phase package, you should use mvn clean package
instead. I think Maven will not pick up your configuration if your run mvn
clean dependency:copy-dependencies

Regards
Jeff


On Wed, Jan 7, 2009 at 7:16 PM, Ryan Moquin <fr...@gmail.com> wrote:

> I'm trying to understand how to use the copy-dependencies goal for the
> maven-dependency-plugin.  Basically I want to just copy a few dependencies
> that are important to a directory, and exclude the rest.  For some reason,
> I
> can't seem to get any of the filters to work, here is an example of the
> plugin definition that gives me trouble:
>
> <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-dependency-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>copy-dependencies</id>
>            <phase>package</phase>
>            <goals>
>              <goal>copy-dependencies</goal>
>            </goals>
>            <configuration>
>              <excludeTypes>zip</excludeTypes>
>              <includeTypes>jar</includeTypes>
>              <failOnWarning>true</failOnWarning>
>
> <outputDirectory>${project.build.directory}/standalone</outputDirectory>
>              <overWriteReleases>false</overWriteReleases>
>              <overWriteSnapshots>false</overWriteSnapshots>
>              <overWriteIfNewer>true</overWriteIfNewer>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>
> If I use the above plugin definition and have dependencies of jar and zip
> types, when I run:
>
> mvn clean dependency:copy-dependencies
>
> I will get all the dependencies to show up in my standalone directory,
> whether or not they are of type jar or zip.  According to the
> documentation,
> this is how you would do it, but no combination of filtering I've tried has
> seemed to work.  Am I doing something wrong?  I'm using version 2.0.9.
> Thanks for any help!!
>
> Ryan
>



-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.lastfm.fr/listen/user/jeffmaury/personal
Mes CDs à récupérer:
http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: maven-dependency-plugin copy-dependencies

Posted by Jeff MAURY <je...@gmail.com>.
Because you bound it to the phase package, you should use mvn clean package
instead. I think Maven will not pick up your configuration if your run mvn
clean dependency:copy-dependencies

Regards
Jeff


On Wed, Jan 7, 2009 at 7:16 PM, Ryan Moquin <fr...@gmail.com> wrote:

> I'm trying to understand how to use the copy-dependencies goal for the
> maven-dependency-plugin.  Basically I want to just copy a few dependencies
> that are important to a directory, and exclude the rest.  For some reason,
> I
> can't seem to get any of the filters to work, here is an example of the
> plugin definition that gives me trouble:
>
> <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-dependency-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>copy-dependencies</id>
>            <phase>package</phase>
>            <goals>
>              <goal>copy-dependencies</goal>
>            </goals>
>            <configuration>
>              <excludeTypes>zip</excludeTypes>
>              <includeTypes>jar</includeTypes>
>              <failOnWarning>true</failOnWarning>
>
> <outputDirectory>${project.build.directory}/standalone</outputDirectory>
>              <overWriteReleases>false</overWriteReleases>
>              <overWriteSnapshots>false</overWriteSnapshots>
>              <overWriteIfNewer>true</overWriteIfNewer>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>
> If I use the above plugin definition and have dependencies of jar and zip
> types, when I run:
>
> mvn clean dependency:copy-dependencies
>
> I will get all the dependencies to show up in my standalone directory,
> whether or not they are of type jar or zip.  According to the
> documentation,
> this is how you would do it, but no combination of filtering I've tried has
> seemed to work.  Am I doing something wrong?  I'm using version 2.0.9.
> Thanks for any help!!
>
> Ryan
>



-- 
La mélancolie c'est communiste
Tout le monde y a droit de temps en temps
La mélancolie n'est pas capitaliste
C'est même gratuit pour les perdants
La mélancolie c'est pacifiste
On ne lui rentre jamais dedans
La mélancolie oh tu sais ça existe
Elle se prend même avec des gants
La mélancolie c'est pour les syndicalistes
Il faut juste sa carte de permanent

Miossec (2006)

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.lastfm.fr/listen/user/jeffmaury/personal
Mes CDs à récupérer:
http://spreadsheets.google.com/ccc?key=pNeg4Doa_oCsh7CepKPaPTA&hl=en