You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by virg g <06...@gmail.com> on 2013/03/19 10:51:02 UTC

maven-dependency-plugin

HI,
I have project which contains many modules and creates jars and wars. My
Build structure is parent POM has all modules. I am placing all my plugins
in PARENT POM to be required to to applied all child modules. My
requirement is to copy all these created jars to one location and wars to
another location. I am using maven-dependency-plugin to do this. This is
sample plugin. I have two issues with this.
1.  I am able to copy all the jars and wars to one folder, but not jars to
one folder and wars to another. Not able to distinguish
2. SInce i have placed this plugin in parent, along with all the jars and
wars, from Parent POM type is POM it is copying project.pom to this
location also. How to exclude project.pom being copied.

Here is my plugin. I have added 2 artifactItems one for jar and another
with war by mentioning TYPE as jar and war for each, also added excludes
and includes, nothing worked. Any solution to my problem? Really it would
be great help.

             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.7</version>
                <executions>
                    <execution>
                        <id>copy-installed</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>

 <artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>${project.packaging}</type>
                                    <overWrite>true</overWrite>

 <destFileName>${project.artifactId}.${project.packaging}</destFileName>
                                </artifactItem>
                               </artifactItems>

 <outputDirectory>../../${install.jar.folder}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Thanks
Virg

RE: maven-dependency-plugin

Posted by Martin Gainty <mg...@hotmail.com>.
so essentially you have 2 different executions which you want to trigger with 2 different profiles 
 
http://www.thinkplexx.com/learn/howto/maven2/m2-execution/configure-default-and-alternative-executions-in-maven-pom-using-profiles

there are a number of triggers you can implement to trigger your profile:

absence or presence of a file
which maven phase you want the execution to bind to
environment variables detection
detection of OS variables
property values
 
http://maven.apache.org/settings.html#Profiles

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

  


> Date: Tue, 19 Mar 2013 12:35:04 +0100
> Subject: Re: maven-dependency-plugin
> From: adrien.rivard@gmail.com
> To: users@maven.apache.org
> 
> Hi,
> Have you try to add two differents executions (with differents id), one
> for type war the others for type jar ?
> 
> 
> On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:
> 
> > HI,
> > I have project which contains many modules and creates jars and wars. My
> > Build structure is parent POM has all modules. I am placing all my plugins
> > in PARENT POM to be required to to applied all child modules. My
> > requirement is to copy all these created jars to one location and wars to
> > another location. I am using maven-dependency-plugin to do this. This is
> > sample plugin. I have two issues with this.
> > 1. I am able to copy all the jars and wars to one folder, but not jars to
> > one folder and wars to another. Not able to distinguish
> > 2. SInce i have placed this plugin in parent, along with all the jars and
> > wars, from Parent POM type is POM it is copying project.pom to this
> > location also. How to exclude project.pom being copied.
> >
> > Here is my plugin. I have added 2 artifactItems one for jar and another
> > with war by mentioning TYPE as jar and war for each, also added excludes
> > and includes, nothing worked. Any solution to my problem? Really it would
> > be great help.
> >
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-dependency-plugin</artifactId>
> > <version>2.7</version>
> > <executions>
> > <execution>
> > <id>copy-installed</id>
> > <phase>install</phase>
> > <goals>
> > <goal>copy</goal>
> > </goals>
> > <configuration>
> > <artifactItems>
> > <artifactItem>
> > <groupId>${project.groupId}</groupId>
> >
> > <artifactId>${project.artifactId}</artifactId>
> > <version>${project.version}</version>
> > <type>${project.packaging}</type>
> > <overWrite>true</overWrite>
> >
> > <destFileName>${project.artifactId}.${project.packaging}</destFileName>
> > </artifactItem>
> > </artifactItems>
> >
> > <outputDirectory>../../${install.jar.folder}</outputDirectory>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> >
> > Thanks
> > Virg
> >
> 
> 
> 
> -- 
> Adrien Rivard
 		 	   		  

Re: maven-dependency-plugin

Posted by Ron Wheeler <rw...@artifact-software.com>.
I may not understand everything that you are trying to do but this looks 
like something that the assembly plug-in or the shade plug-in might 
accomplish in a more straightforward fashion.

Ron
On 19/03/2013 8:39 AM, virg g wrote:
> Hi,
> Yes have added as two different artifactItems like this
> Since I have placed this in Parent POM, it was trying to copy even my
> PARENT artifact (parentProj) which is of Type POM.
> My Guess the PARENT POM is causing this issue, since its type POM, And i
> have added another section for this also as type pom, but it did not help.
> Is there anyaway to exclude Parent Artifact being copied?
> This is the error i am getting
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-dependency-plugin:
> 2.7:copy (copy-installed) on project parentProj: Unable to find artifact.
> Failure to find parentProj:jar:1.1-SNAPSHOT in
> http://repo1.maven.org/maven2was cached in the local repository,
> resolution will not be reattempted
> until the update interval of central has elapsed or updates are forced
>
> This is my sample conf
>
>                         <artifactItems>
>                                  <artifactItem>
>                                      <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                      <version>${project.version}</version>
>                                      <type>pom</type>
>                                      -----
>                                  </artifactItem>
>                                  <artifactItem>
>                                      <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                      <version>${project.version}</version>
>                                      <type>jar</type>
>                                      ---------
>                                  </artifactItem>
>                                  <artifactItem>
>                                      <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                      <version>${project.version}</version>
>                                      <type>war</type>
>                                      -----------
>                                  </artifactItem>
>                              </artifactItems>
>
> On Tue, Mar 19, 2013 at 5:05 PM, Adrien Rivard <ad...@gmail.com>wrote:
>
>> Hi,
>> Have you try  to add two differents executions (with differents id), one
>> for type war the others for type jar ?
>>
>>
>> On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:
>>
>>> HI,
>>> I have project which contains many modules and creates jars and wars. My
>>> Build structure is parent POM has all modules. I am placing all my
>> plugins
>>> in PARENT POM to be required to to applied all child modules. My
>>> requirement is to copy all these created jars to one location and wars to
>>> another location. I am using maven-dependency-plugin to do this. This is
>>> sample plugin. I have two issues with this.
>>> 1.  I am able to copy all the jars and wars to one folder, but not jars
>> to
>>> one folder and wars to another. Not able to distinguish
>>> 2. SInce i have placed this plugin in parent, along with all the jars and
>>> wars, from Parent POM type is POM it is copying project.pom to this
>>> location also. How to exclude project.pom being copied.
>>>
>>> Here is my plugin. I have added 2 artifactItems one for jar and another
>>> with war by mentioning TYPE as jar and war for each, also added excludes
>>> and includes, nothing worked. Any solution to my problem? Really it would
>>> be great help.
>>>
>>>               <plugin>
>>>                  <groupId>org.apache.maven.plugins</groupId>
>>>                  <artifactId>maven-dependency-plugin</artifactId>
>>>                  <version>2.7</version>
>>>                  <executions>
>>>                      <execution>
>>>                          <id>copy-installed</id>
>>>                          <phase>install</phase>
>>>                          <goals>
>>>                              <goal>copy</goal>
>>>                          </goals>
>>>                          <configuration>
>>>                              <artifactItems>
>>>                                  <artifactItem>
>>>                                      <groupId>${project.groupId}</groupId>
>>>
>>>   <artifactId>${project.artifactId}</artifactId>
>>>                                      <version>${project.version}</version>
>>>                                      <type>${project.packaging}</type>
>>>                                      <overWrite>true</overWrite>
>>>
>>>   <destFileName>${project.artifactId}.${project.packaging}</destFileName>
>>>                                  </artifactItem>
>>>                                 </artifactItems>
>>>
>>>   <outputDirectory>../../${install.jar.folder}</outputDirectory>
>>>                          </configuration>
>>>                      </execution>
>>>                  </executions>
>>>              </plugin>
>>>
>>> Thanks
>>> Virg
>>>
>>
>>
>> --
>> Adrien Rivard
>>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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


Re: maven-dependency-plugin

Posted by virg g <06...@gmail.com>.
Hi
Thank you. But this copies only the dependencies. But i want to copy all
the artifactids i.e my project build creats jars and wars, and i need to
copy all the jars with md5 to one location and wars with md5 to another
location. I used this sample code, could not understand why it is not
filtering based on types. it copies both jars and wars to same location
irrespective what type it is, it is ignoring
<includeTypes>jar</includeTypes>, where i am doing wrong. Any help is
highly appreciated. I have added different excutions section with
includeTypes as war, it copies all the files to both the folders.
<execution>
                        <id>copy-jar</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <includeTypes>jar</includeTypes>
                            <overWrite>true</overWrite>
                            <outputDirectory>../../aa</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>

<artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>${project.packaging}</type>
                                </artifactItem>
                            </artifactItems>
                         </configuration>
                    </execution>

Thanks
virg



>
>
> On Tue, Mar 19, 2013 at 7:55 PM, Adrien Rivard <ad...@gmail.com>wrote:
>
>> On Tue, Mar 19, 2013 at 1:39 PM, virg g <06...@gmail.com> wrote:
>>
>> > Hi,
>> > Yes have added as two different artifactItems like this
>> > Since I have placed this in Parent POM, it was trying to copy even my
>> > PARENT artifact (parentProj) which is of Type POM.
>> > My Guess the PARENT POM is causing this issue, since its type POM, And i
>> > have added another section for this also as type pom, but it did not
>> help.
>> > Is there anyaway to exclude Parent Artifact being copied?
>> > This is the error i am getting
>> > [ERROR] Failed to execute goal
>> > org.apache.maven.plugins:maven-dependency-plugin:
>> > 2.7:copy (copy-installed) on project parentProj: Unable to find
>> artifact.
>> > Failure to find parentProj:jar:1.1-SNAPSHOT in
>> > http://repo1.maven.org/maven2was cached in the local repository,
>> > resolution will not be reattempted
>> > until the update interval of central has elapsed or updates are forced
>> >
>> > This is my sample conf
>> >
>> >                        <artifactItems>
>> >                                 <artifactItem>
>> >
>> <groupId>${project.groupId}</groupId>
>> >
>> > <artifactId>${project.artifactId}</artifactId>
>> >
>> <version>${project.version}</version>
>> >                                     <type>pom</type>
>> >                                     -----
>> >                                 </artifactItem>
>> >                                 <artifactItem>
>> >
>> <groupId>${project.groupId}</groupId>
>> >
>> > <artifactId>${project.artifactId}</artifactId>
>> >
>> <version>${project.version}</version>
>> >                                     <type>jar</type>
>> >                                     ---------
>> >                                 </artifactItem>
>> >                                 <artifactItem>
>> >
>> <groupId>${project.groupId}</groupId>
>> >
>> > <artifactId>${project.artifactId}</artifactId>
>> >
>> <version>${project.version}</version>
>> >                                     <type>war</type>
>> >                                     -----------
>> >                                 </artifactItem>
>> >                             </artifactItems>
>> >
>> >
>> I was suggested something like
>>
>>                             <executions>
>> <execution>
>> <id>copy-jar</id>
>> <phase>package</phase>
>> <goals>
>> <goal>copy-dependencies</goal>
>> </goals>
>> <configuration>
>> <includeTypes>jar</includeTypes>
>> <outputDirectory>../../jar</outputDirectory>
>> </configuration>
>> </execution>
>> <execution>
>> <id>copy-war</id>
>> <phase>package</phase>
>> <goals>
>> <goal>copy-dependencies</goal>
>> </goals>
>> <configuration>
>> <includeTypes>war</includeTypes>
>> <outputDirectory>../../war</outputDirectory>
>> </configuration>
>> </execution>
>> </executions>
>>
>> Also if I  understand it correctly the ${project*} variables are resolved
>> in the context of the parent project, so not exactly what you (seems to)
>> want.
>>
>> What are you trying to achieve with this ?
>>
>> On Tue, Mar 19, 2013 at 5:05 PM, Adrien Rivard <adrien.rivard@gmail.com
>> > >wrote:
>> >
>> > > Hi,
>> > > Have you try  to add two differents executions (with differents id),
>> one
>> > > for type war the others for type jar ?
>> > >
>> > >
>> > > On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:
>> > >
>> > > > HI,
>> > > > I have project which contains many modules and creates jars and
>> wars.
>> > My
>> > > > Build structure is parent POM has all modules. I am placing all my
>> > > plugins
>> > > > in PARENT POM to be required to to applied all child modules. My
>> > > > requirement is to copy all these created jars to one location and
>> wars
>> > to
>> > > > another location. I am using maven-dependency-plugin to do this.
>> This
>> > is
>> > > > sample plugin. I have two issues with this.
>> > > > 1.  I am able to copy all the jars and wars to one folder, but not
>> jars
>> > > to
>> > > > one folder and wars to another. Not able to distinguish
>> > > > 2. SInce i have placed this plugin in parent, along with all the
>> jars
>> > and
>> > > > wars, from Parent POM type is POM it is copying project.pom to this
>> > > > location also. How to exclude project.pom being copied.
>> > > >
>> > > > Here is my plugin. I have added 2 artifactItems one for jar and
>> another
>> > > > with war by mentioning TYPE as jar and war for each, also added
>> > excludes
>> > > > and includes, nothing worked. Any solution to my problem? Really it
>> > would
>> > > > be great help.
>> > > >
>> > > >              <plugin>
>> > > >                 <groupId>org.apache.maven.plugins</groupId>
>> > > >                 <artifactId>maven-dependency-plugin</artifactId>
>> > > >                 <version>2.7</version>
>> > > >                 <executions>
>> > > >                     <execution>
>> > > >                         <id>copy-installed</id>
>> > > >                         <phase>install</phase>
>> > > >                         <goals>
>> > > >                             <goal>copy</goal>
>> > > >                         </goals>
>> > > >                         <configuration>
>> > > >                             <artifactItems>
>> > > >                                 <artifactItem>
>> > > >
>> > <groupId>${project.groupId}</groupId>
>> > > >
>> > > >  <artifactId>${project.artifactId}</artifactId>
>> > > >
>> > <version>${project.version}</version>
>> > > >
>> <type>${project.packaging}</type>
>> > > >                                     <overWrite>true</overWrite>
>> > > >
>> > > >
>> >  <destFileName>${project.artifactId}.${project.packaging}</destFileName>
>> > > >                                 </artifactItem>
>> > > >                                </artifactItems>
>> > > >
>> > > >  <outputDirectory>../../${install.jar.folder}</outputDirectory>
>> > > >                         </configuration>
>> > > >                     </execution>
>> > > >                 </executions>
>> > > >             </plugin>
>> > > >
>> > > > Thanks
>> > > > Virg
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Adrien Rivard
>> > >
>> >
>>
>>
>>
>> --
>> Adrien Rivard
>>
>
>

Re: maven-dependency-plugin

Posted by virg g <06...@gmail.com>.
Hi,
T

On Tue, Mar 19, 2013 at 7:55 PM, Adrien Rivard <ad...@gmail.com>wrote:

> On Tue, Mar 19, 2013 at 1:39 PM, virg g <06...@gmail.com> wrote:
>
> > Hi,
> > Yes have added as two different artifactItems like this
> > Since I have placed this in Parent POM, it was trying to copy even my
> > PARENT artifact (parentProj) which is of Type POM.
> > My Guess the PARENT POM is causing this issue, since its type POM, And i
> > have added another section for this also as type pom, but it did not
> help.
> > Is there anyaway to exclude Parent Artifact being copied?
> > This is the error i am getting
> > [ERROR] Failed to execute goal
> > org.apache.maven.plugins:maven-dependency-plugin:
> > 2.7:copy (copy-installed) on project parentProj: Unable to find artifact.
> > Failure to find parentProj:jar:1.1-SNAPSHOT in
> > http://repo1.maven.org/maven2was cached in the local repository,
> > resolution will not be reattempted
> > until the update interval of central has elapsed or updates are forced
> >
> > This is my sample conf
> >
> >                        <artifactItems>
> >                                 <artifactItem>
> >                                     <groupId>${project.groupId}</groupId>
> >
> > <artifactId>${project.artifactId}</artifactId>
> >                                     <version>${project.version}</version>
> >                                     <type>pom</type>
> >                                     -----
> >                                 </artifactItem>
> >                                 <artifactItem>
> >                                     <groupId>${project.groupId}</groupId>
> >
> > <artifactId>${project.artifactId}</artifactId>
> >                                     <version>${project.version}</version>
> >                                     <type>jar</type>
> >                                     ---------
> >                                 </artifactItem>
> >                                 <artifactItem>
> >                                     <groupId>${project.groupId}</groupId>
> >
> > <artifactId>${project.artifactId}</artifactId>
> >                                     <version>${project.version}</version>
> >                                     <type>war</type>
> >                                     -----------
> >                                 </artifactItem>
> >                             </artifactItems>
> >
> >
> I was suggested something like
>
>                             <executions>
> <execution>
> <id>copy-jar</id>
> <phase>package</phase>
> <goals>
> <goal>copy-dependencies</goal>
> </goals>
> <configuration>
> <includeTypes>jar</includeTypes>
> <outputDirectory>../../jar</outputDirectory>
> </configuration>
> </execution>
> <execution>
> <id>copy-war</id>
> <phase>package</phase>
> <goals>
> <goal>copy-dependencies</goal>
> </goals>
> <configuration>
> <includeTypes>war</includeTypes>
> <outputDirectory>../../war</outputDirectory>
> </configuration>
> </execution>
> </executions>
>
> Also if I  understand it correctly the ${project*} variables are resolved
> in the context of the parent project, so not exactly what you (seems to)
> want.
>
> What are you trying to achieve with this ?
>
> On Tue, Mar 19, 2013 at 5:05 PM, Adrien Rivard <adrien.rivard@gmail.com
> > >wrote:
> >
> > > Hi,
> > > Have you try  to add two differents executions (with differents id),
> one
> > > for type war the others for type jar ?
> > >
> > >
> > > On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:
> > >
> > > > HI,
> > > > I have project which contains many modules and creates jars and wars.
> > My
> > > > Build structure is parent POM has all modules. I am placing all my
> > > plugins
> > > > in PARENT POM to be required to to applied all child modules. My
> > > > requirement is to copy all these created jars to one location and
> wars
> > to
> > > > another location. I am using maven-dependency-plugin to do this. This
> > is
> > > > sample plugin. I have two issues with this.
> > > > 1.  I am able to copy all the jars and wars to one folder, but not
> jars
> > > to
> > > > one folder and wars to another. Not able to distinguish
> > > > 2. SInce i have placed this plugin in parent, along with all the jars
> > and
> > > > wars, from Parent POM type is POM it is copying project.pom to this
> > > > location also. How to exclude project.pom being copied.
> > > >
> > > > Here is my plugin. I have added 2 artifactItems one for jar and
> another
> > > > with war by mentioning TYPE as jar and war for each, also added
> > excludes
> > > > and includes, nothing worked. Any solution to my problem? Really it
> > would
> > > > be great help.
> > > >
> > > >              <plugin>
> > > >                 <groupId>org.apache.maven.plugins</groupId>
> > > >                 <artifactId>maven-dependency-plugin</artifactId>
> > > >                 <version>2.7</version>
> > > >                 <executions>
> > > >                     <execution>
> > > >                         <id>copy-installed</id>
> > > >                         <phase>install</phase>
> > > >                         <goals>
> > > >                             <goal>copy</goal>
> > > >                         </goals>
> > > >                         <configuration>
> > > >                             <artifactItems>
> > > >                                 <artifactItem>
> > > >
> > <groupId>${project.groupId}</groupId>
> > > >
> > > >  <artifactId>${project.artifactId}</artifactId>
> > > >
> > <version>${project.version}</version>
> > > >                                     <type>${project.packaging}</type>
> > > >                                     <overWrite>true</overWrite>
> > > >
> > > >
> >  <destFileName>${project.artifactId}.${project.packaging}</destFileName>
> > > >                                 </artifactItem>
> > > >                                </artifactItems>
> > > >
> > > >  <outputDirectory>../../${install.jar.folder}</outputDirectory>
> > > >                         </configuration>
> > > >                     </execution>
> > > >                 </executions>
> > > >             </plugin>
> > > >
> > > > Thanks
> > > > Virg
> > > >
> > >
> > >
> > >
> > > --
> > > Adrien Rivard
> > >
> >
>
>
>
> --
> Adrien Rivard
>

Re: maven-dependency-plugin

Posted by Adrien Rivard <ad...@gmail.com>.
On Tue, Mar 19, 2013 at 1:39 PM, virg g <06...@gmail.com> wrote:

> Hi,
> Yes have added as two different artifactItems like this
> Since I have placed this in Parent POM, it was trying to copy even my
> PARENT artifact (parentProj) which is of Type POM.
> My Guess the PARENT POM is causing this issue, since its type POM, And i
> have added another section for this also as type pom, but it did not help.
> Is there anyaway to exclude Parent Artifact being copied?
> This is the error i am getting
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-dependency-plugin:
> 2.7:copy (copy-installed) on project parentProj: Unable to find artifact.
> Failure to find parentProj:jar:1.1-SNAPSHOT in
> http://repo1.maven.org/maven2was cached in the local repository,
> resolution will not be reattempted
> until the update interval of central has elapsed or updates are forced
>
> This is my sample conf
>
>                        <artifactItems>
>                                 <artifactItem>
>                                     <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                     <version>${project.version}</version>
>                                     <type>pom</type>
>                                     -----
>                                 </artifactItem>
>                                 <artifactItem>
>                                     <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                     <version>${project.version}</version>
>                                     <type>jar</type>
>                                     ---------
>                                 </artifactItem>
>                                 <artifactItem>
>                                     <groupId>${project.groupId}</groupId>
>
> <artifactId>${project.artifactId}</artifactId>
>                                     <version>${project.version}</version>
>                                     <type>war</type>
>                                     -----------
>                                 </artifactItem>
>                             </artifactItems>
>
>
I was suggested something like

                            <executions>
<execution>
<id>copy-jar</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeTypes>jar</includeTypes>
<outputDirectory>../../jar</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-war</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeTypes>war</includeTypes>
<outputDirectory>../../war</outputDirectory>
</configuration>
</execution>
</executions>

Also if I  understand it correctly the ${project*} variables are resolved
in the context of the parent project, so not exactly what you (seems to)
want.

What are you trying to achieve with this ?

On Tue, Mar 19, 2013 at 5:05 PM, Adrien Rivard <adrien.rivard@gmail.com
> >wrote:
>
> > Hi,
> > Have you try  to add two differents executions (with differents id), one
> > for type war the others for type jar ?
> >
> >
> > On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:
> >
> > > HI,
> > > I have project which contains many modules and creates jars and wars.
> My
> > > Build structure is parent POM has all modules. I am placing all my
> > plugins
> > > in PARENT POM to be required to to applied all child modules. My
> > > requirement is to copy all these created jars to one location and wars
> to
> > > another location. I am using maven-dependency-plugin to do this. This
> is
> > > sample plugin. I have two issues with this.
> > > 1.  I am able to copy all the jars and wars to one folder, but not jars
> > to
> > > one folder and wars to another. Not able to distinguish
> > > 2. SInce i have placed this plugin in parent, along with all the jars
> and
> > > wars, from Parent POM type is POM it is copying project.pom to this
> > > location also. How to exclude project.pom being copied.
> > >
> > > Here is my plugin. I have added 2 artifactItems one for jar and another
> > > with war by mentioning TYPE as jar and war for each, also added
> excludes
> > > and includes, nothing worked. Any solution to my problem? Really it
> would
> > > be great help.
> > >
> > >              <plugin>
> > >                 <groupId>org.apache.maven.plugins</groupId>
> > >                 <artifactId>maven-dependency-plugin</artifactId>
> > >                 <version>2.7</version>
> > >                 <executions>
> > >                     <execution>
> > >                         <id>copy-installed</id>
> > >                         <phase>install</phase>
> > >                         <goals>
> > >                             <goal>copy</goal>
> > >                         </goals>
> > >                         <configuration>
> > >                             <artifactItems>
> > >                                 <artifactItem>
> > >
> <groupId>${project.groupId}</groupId>
> > >
> > >  <artifactId>${project.artifactId}</artifactId>
> > >
> <version>${project.version}</version>
> > >                                     <type>${project.packaging}</type>
> > >                                     <overWrite>true</overWrite>
> > >
> > >
>  <destFileName>${project.artifactId}.${project.packaging}</destFileName>
> > >                                 </artifactItem>
> > >                                </artifactItems>
> > >
> > >  <outputDirectory>../../${install.jar.folder}</outputDirectory>
> > >                         </configuration>
> > >                     </execution>
> > >                 </executions>
> > >             </plugin>
> > >
> > > Thanks
> > > Virg
> > >
> >
> >
> >
> > --
> > Adrien Rivard
> >
>



-- 
Adrien Rivard

Re: maven-dependency-plugin

Posted by virg g <06...@gmail.com>.
Hi,
Yes have added as two different artifactItems like this
Since I have placed this in Parent POM, it was trying to copy even my
PARENT artifact (parentProj) which is of Type POM.
My Guess the PARENT POM is causing this issue, since its type POM, And i
have added another section for this also as type pom, but it did not help.
Is there anyaway to exclude Parent Artifact being copied?
This is the error i am getting
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:
2.7:copy (copy-installed) on project parentProj: Unable to find artifact.
Failure to find parentProj:jar:1.1-SNAPSHOT in
http://repo1.maven.org/maven2was cached in the local repository,
resolution will not be reattempted
until the update interval of central has elapsed or updates are forced

This is my sample conf

                       <artifactItems>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>

<artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>pom</type>
                                    -----
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>

<artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>jar</type>
                                    ---------
                                </artifactItem>
                                <artifactItem>
                                    <groupId>${project.groupId}</groupId>

<artifactId>${project.artifactId}</artifactId>
                                    <version>${project.version}</version>
                                    <type>war</type>
                                    -----------
                                </artifactItem>
                            </artifactItems>

On Tue, Mar 19, 2013 at 5:05 PM, Adrien Rivard <ad...@gmail.com>wrote:

> Hi,
> Have you try  to add two differents executions (with differents id), one
> for type war the others for type jar ?
>
>
> On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:
>
> > HI,
> > I have project which contains many modules and creates jars and wars. My
> > Build structure is parent POM has all modules. I am placing all my
> plugins
> > in PARENT POM to be required to to applied all child modules. My
> > requirement is to copy all these created jars to one location and wars to
> > another location. I am using maven-dependency-plugin to do this. This is
> > sample plugin. I have two issues with this.
> > 1.  I am able to copy all the jars and wars to one folder, but not jars
> to
> > one folder and wars to another. Not able to distinguish
> > 2. SInce i have placed this plugin in parent, along with all the jars and
> > wars, from Parent POM type is POM it is copying project.pom to this
> > location also. How to exclude project.pom being copied.
> >
> > Here is my plugin. I have added 2 artifactItems one for jar and another
> > with war by mentioning TYPE as jar and war for each, also added excludes
> > and includes, nothing worked. Any solution to my problem? Really it would
> > be great help.
> >
> >              <plugin>
> >                 <groupId>org.apache.maven.plugins</groupId>
> >                 <artifactId>maven-dependency-plugin</artifactId>
> >                 <version>2.7</version>
> >                 <executions>
> >                     <execution>
> >                         <id>copy-installed</id>
> >                         <phase>install</phase>
> >                         <goals>
> >                             <goal>copy</goal>
> >                         </goals>
> >                         <configuration>
> >                             <artifactItems>
> >                                 <artifactItem>
> >                                     <groupId>${project.groupId}</groupId>
> >
> >  <artifactId>${project.artifactId}</artifactId>
> >                                     <version>${project.version}</version>
> >                                     <type>${project.packaging}</type>
> >                                     <overWrite>true</overWrite>
> >
> >  <destFileName>${project.artifactId}.${project.packaging}</destFileName>
> >                                 </artifactItem>
> >                                </artifactItems>
> >
> >  <outputDirectory>../../${install.jar.folder}</outputDirectory>
> >                         </configuration>
> >                     </execution>
> >                 </executions>
> >             </plugin>
> >
> > Thanks
> > Virg
> >
>
>
>
> --
> Adrien Rivard
>

Re: maven-dependency-plugin

Posted by Adrien Rivard <ad...@gmail.com>.
Hi,
Have you try  to add two differents executions (with differents id), one
for type war the others for type jar ?


On Tue, Mar 19, 2013 at 10:51 AM, virg g <06...@gmail.com> wrote:

> HI,
> I have project which contains many modules and creates jars and wars. My
> Build structure is parent POM has all modules. I am placing all my plugins
> in PARENT POM to be required to to applied all child modules. My
> requirement is to copy all these created jars to one location and wars to
> another location. I am using maven-dependency-plugin to do this. This is
> sample plugin. I have two issues with this.
> 1.  I am able to copy all the jars and wars to one folder, but not jars to
> one folder and wars to another. Not able to distinguish
> 2. SInce i have placed this plugin in parent, along with all the jars and
> wars, from Parent POM type is POM it is copying project.pom to this
> location also. How to exclude project.pom being copied.
>
> Here is my plugin. I have added 2 artifactItems one for jar and another
> with war by mentioning TYPE as jar and war for each, also added excludes
> and includes, nothing worked. Any solution to my problem? Really it would
> be great help.
>
>              <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-dependency-plugin</artifactId>
>                 <version>2.7</version>
>                 <executions>
>                     <execution>
>                         <id>copy-installed</id>
>                         <phase>install</phase>
>                         <goals>
>                             <goal>copy</goal>
>                         </goals>
>                         <configuration>
>                             <artifactItems>
>                                 <artifactItem>
>                                     <groupId>${project.groupId}</groupId>
>
>  <artifactId>${project.artifactId}</artifactId>
>                                     <version>${project.version}</version>
>                                     <type>${project.packaging}</type>
>                                     <overWrite>true</overWrite>
>
>  <destFileName>${project.artifactId}.${project.packaging}</destFileName>
>                                 </artifactItem>
>                                </artifactItems>
>
>  <outputDirectory>../../${install.jar.folder}</outputDirectory>
>                         </configuration>
>                     </execution>
>                 </executions>
>             </plugin>
>
> Thanks
> Virg
>



-- 
Adrien Rivard