You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Norbert Lazzeri <el...@gmx.de> on 2008/09/29 14:43:09 UTC

copy libraries to classpath

Hi,

is it possible to let maven copy all dependencies to my classpath?

my jar-configuration looks like:
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                          <addClasspath>true</addClasspath>
                          
<classpathPrefix>lib/</classpathPrefix>                           
                          <mainClass>uboot.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
             </plugin>

so it would be nice if maven would create a lib-directory and copy all 
jars in to it since there are plenty of them and doing this by hand is 
troublesome

cheers,
Norbert

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


Re: copy libraries to classpath

Posted by Norbert Lazzeri <el...@gmx.de>.
that solved the problem, thx!

now my plugin-configuration looks like
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
                    <overWriteReleases>false</overWriteReleases>
                    <overWriteSnapshots>false</overWriteSnapshots>
                    <overWriteIfNewer>true</overWriteIfNewer>
                </configuration>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

and everything works fine


cheers
Norbert

Brian E. Fox schrieb:
> The ArtifactItem construct is only used for copy/unpack not copy-dependencies/unpack-dependencies.
>
> More likely is that you are running this from the command line like mvn dependency:copy-dependencies and it's not configured that way. If you want it to work from the command line, don't put it inside an executions block. (this is a maven issue, there is talk about it in the plugin faq)
>
> -----Original Message-----
> From: Norbert Lazzeri [mailto:elnogge@gmx.de] 
> Sent: Monday, September 29, 2008 9:29 AM
> To: Maven Users List
> Subject: Re: copy libraries to classpath
>
> yeah i red that too. but i thought this would refer to the 
> configuration-section of the plugin :-S
>
> cheers
> norbert
>
> Nick Stolwijk schrieb:
>   
>> I think the outputDirectory is ignored because of the ArtifactItem
>> (whatever that may be... ;) )
>>
>> >From the documentation:
>>
>> outputDirectory :
>>
>> Default location used for mojo unless overridden in ArtifactItem
>>
>>     * Type: java.io.File
>>     * Since: 1.0
>>     * Required: No
>>     * Expression: ${outputDirectory}
>>     * Default: ${project.build.directory}/dependency
>>
>> Hth,
>>
>> Nick Stolwijk
>> ~Java Developer~
>>
>> Iprofs BV.
>> Claus Sluterweg 125
>> 2012 WS Haarlem
>> www.iprofs.nl
>>
>>
>>
>> On Mon, Sep 29, 2008 at 3:01 PM, Norbert Lazzeri <el...@gmx.de> wrote:
>>   
>>     
>>> using the maven-dependency-plugin with:
>>>                  <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>
>>>
>>> <outputDirectory>${project.build.directory}/lib</outputDirectory>
>>>                         <overWriteReleases>false</overWriteReleases>
>>>                         <overWriteSnapshots>false</overWriteSnapshots>
>>>                         <overWriteIfNewer>true</overWriteIfNewer>
>>>                       </configuration>
>>>                     </execution>
>>>                   </executions>
>>>                 </plugin>
>>>
>>> like suggested on the plugin-homepage all dependencies are copied to
>>> targed/dependencies. why is the outputDirectory ignored?
>>>
>>> cheers,
>>> Norbert
>>>
>>> Norbert Lazzeri schrieb:
>>>     
>>>       
>>>> Hi,
>>>>
>>>> is it possible to let maven copy all dependencies to my classpath?
>>>>
>>>> my jar-configuration looks like:
>>>>           <plugin>
>>>>               <groupId>org.apache.maven.plugins</groupId>
>>>>               <artifactId>maven-jar-plugin</artifactId>
>>>>               <configuration>
>>>>                   <archive>
>>>>                       <manifest>
>>>>                         <addClasspath>true</addClasspath>
>>>>                         <classpathPrefix>lib/</classpathPrefix>
>>>>                                         <mainClass>uboot.App</mainClass>
>>>>                       </manifest>
>>>>                   </archive>
>>>>               </configuration>
>>>>            </plugin>
>>>>
>>>> so it would be nice if maven would create a lib-directory and copy all
>>>> jars in to it since there are plenty of them and doing this by hand is
>>>> troublesome
>>>>
>>>> cheers,
>>>> Norbert
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>       
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>     
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>   
>>     

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


RE: copy libraries to classpath

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
The ArtifactItem construct is only used for copy/unpack not copy-dependencies/unpack-dependencies.

More likely is that you are running this from the command line like mvn dependency:copy-dependencies and it's not configured that way. If you want it to work from the command line, don't put it inside an executions block. (this is a maven issue, there is talk about it in the plugin faq)

-----Original Message-----
From: Norbert Lazzeri [mailto:elnogge@gmx.de] 
Sent: Monday, September 29, 2008 9:29 AM
To: Maven Users List
Subject: Re: copy libraries to classpath

yeah i red that too. but i thought this would refer to the 
configuration-section of the plugin :-S

cheers
norbert

Nick Stolwijk schrieb:
> I think the outputDirectory is ignored because of the ArtifactItem
> (whatever that may be... ;) )
>
> >From the documentation:
>
> outputDirectory :
>
> Default location used for mojo unless overridden in ArtifactItem
>
>     * Type: java.io.File
>     * Since: 1.0
>     * Required: No
>     * Expression: ${outputDirectory}
>     * Default: ${project.build.directory}/dependency
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> Iprofs BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> www.iprofs.nl
>
>
>
> On Mon, Sep 29, 2008 at 3:01 PM, Norbert Lazzeri <el...@gmx.de> wrote:
>   
>> using the maven-dependency-plugin with:
>>                  <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>
>>
>> <outputDirectory>${project.build.directory}/lib</outputDirectory>
>>                         <overWriteReleases>false</overWriteReleases>
>>                         <overWriteSnapshots>false</overWriteSnapshots>
>>                         <overWriteIfNewer>true</overWriteIfNewer>
>>                       </configuration>
>>                     </execution>
>>                   </executions>
>>                 </plugin>
>>
>> like suggested on the plugin-homepage all dependencies are copied to
>> targed/dependencies. why is the outputDirectory ignored?
>>
>> cheers,
>> Norbert
>>
>> Norbert Lazzeri schrieb:
>>     
>>> Hi,
>>>
>>> is it possible to let maven copy all dependencies to my classpath?
>>>
>>> my jar-configuration looks like:
>>>           <plugin>
>>>               <groupId>org.apache.maven.plugins</groupId>
>>>               <artifactId>maven-jar-plugin</artifactId>
>>>               <configuration>
>>>                   <archive>
>>>                       <manifest>
>>>                         <addClasspath>true</addClasspath>
>>>                         <classpathPrefix>lib/</classpathPrefix>
>>>                                         <mainClass>uboot.App</mainClass>
>>>                       </manifest>
>>>                   </archive>
>>>               </configuration>
>>>            </plugin>
>>>
>>> so it would be nice if maven would create a lib-directory and copy all
>>> jars in to it since there are plenty of them and doing this by hand is
>>> troublesome
>>>
>>> cheers,
>>> Norbert
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>   

Re: copy libraries to classpath

Posted by Norbert Lazzeri <el...@gmx.de>.
yeah i red that too. but i thought this would refer to the 
configuration-section of the plugin :-S

cheers
norbert

Nick Stolwijk schrieb:
> I think the outputDirectory is ignored because of the ArtifactItem
> (whatever that may be... ;) )
>
> >From the documentation:
>
> outputDirectory :
>
> Default location used for mojo unless overridden in ArtifactItem
>
>     * Type: java.io.File
>     * Since: 1.0
>     * Required: No
>     * Expression: ${outputDirectory}
>     * Default: ${project.build.directory}/dependency
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> Iprofs BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> www.iprofs.nl
>
>
>
> On Mon, Sep 29, 2008 at 3:01 PM, Norbert Lazzeri <el...@gmx.de> wrote:
>   
>> using the maven-dependency-plugin with:
>>                  <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>
>>
>> <outputDirectory>${project.build.directory}/lib</outputDirectory>
>>                         <overWriteReleases>false</overWriteReleases>
>>                         <overWriteSnapshots>false</overWriteSnapshots>
>>                         <overWriteIfNewer>true</overWriteIfNewer>
>>                       </configuration>
>>                     </execution>
>>                   </executions>
>>                 </plugin>
>>
>> like suggested on the plugin-homepage all dependencies are copied to
>> targed/dependencies. why is the outputDirectory ignored?
>>
>> cheers,
>> Norbert
>>
>> Norbert Lazzeri schrieb:
>>     
>>> Hi,
>>>
>>> is it possible to let maven copy all dependencies to my classpath?
>>>
>>> my jar-configuration looks like:
>>>           <plugin>
>>>               <groupId>org.apache.maven.plugins</groupId>
>>>               <artifactId>maven-jar-plugin</artifactId>
>>>               <configuration>
>>>                   <archive>
>>>                       <manifest>
>>>                         <addClasspath>true</addClasspath>
>>>                         <classpathPrefix>lib/</classpathPrefix>
>>>                                         <mainClass>uboot.App</mainClass>
>>>                       </manifest>
>>>                   </archive>
>>>               </configuration>
>>>            </plugin>
>>>
>>> so it would be nice if maven would create a lib-directory and copy all
>>> jars in to it since there are plenty of them and doing this by hand is
>>> troublesome
>>>
>>> cheers,
>>> Norbert
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>   

Re: copy libraries to classpath

Posted by Nick Stolwijk <ni...@gmail.com>.
I think the outputDirectory is ignored because of the ArtifactItem
(whatever that may be... ;) )

>From the documentation:

outputDirectory :

Default location used for mojo unless overridden in ArtifactItem

    * Type: java.io.File
    * Since: 1.0
    * Required: No
    * Expression: ${outputDirectory}
    * Default: ${project.build.directory}/dependency

Hth,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Mon, Sep 29, 2008 at 3:01 PM, Norbert Lazzeri <el...@gmx.de> wrote:
> using the maven-dependency-plugin with:
>                  <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>
>
> <outputDirectory>${project.build.directory}/lib</outputDirectory>
>                         <overWriteReleases>false</overWriteReleases>
>                         <overWriteSnapshots>false</overWriteSnapshots>
>                         <overWriteIfNewer>true</overWriteIfNewer>
>                       </configuration>
>                     </execution>
>                   </executions>
>                 </plugin>
>
> like suggested on the plugin-homepage all dependencies are copied to
> targed/dependencies. why is the outputDirectory ignored?
>
> cheers,
> Norbert
>
> Norbert Lazzeri schrieb:
>>
>> Hi,
>>
>> is it possible to let maven copy all dependencies to my classpath?
>>
>> my jar-configuration looks like:
>>           <plugin>
>>               <groupId>org.apache.maven.plugins</groupId>
>>               <artifactId>maven-jar-plugin</artifactId>
>>               <configuration>
>>                   <archive>
>>                       <manifest>
>>                         <addClasspath>true</addClasspath>
>>                         <classpathPrefix>lib/</classpathPrefix>
>>                                         <mainClass>uboot.App</mainClass>
>>                       </manifest>
>>                   </archive>
>>               </configuration>
>>            </plugin>
>>
>> so it would be nice if maven would create a lib-directory and copy all
>> jars in to it since there are plenty of them and doing this by hand is
>> troublesome
>>
>> cheers,
>> Norbert
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: copy libraries to classpath

Posted by Norbert Lazzeri <el...@gmx.de>.
using the maven-dependency-plugin with:
                   <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>
                          
<outputDirectory>${project.build.directory}/lib</outputDirectory>
                          <overWriteReleases>false</overWriteReleases>
                          <overWriteSnapshots>false</overWriteSnapshots>
                          <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                      </execution>
                    </executions>
                  </plugin>

like suggested on the plugin-homepage all dependencies are copied to 
targed/dependencies. why is the outputDirectory ignored?

cheers,
Norbert

Norbert Lazzeri schrieb:
> Hi,
>
> is it possible to let maven copy all dependencies to my classpath?
>
> my jar-configuration looks like:
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-jar-plugin</artifactId>
>                <configuration>
>                    <archive>
>                        <manifest>
>                          <addClasspath>true</addClasspath>
>                          
> <classpathPrefix>lib/</classpathPrefix>                           
>                          <mainClass>uboot.App</mainClass>
>                        </manifest>
>                    </archive>
>                </configuration>
>             </plugin>
>
> so it would be nice if maven would create a lib-directory and copy all 
> jars in to it since there are plenty of them and doing this by hand is 
> troublesome
>
> cheers,
> Norbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>

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