You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stéphane Philippart <st...@prima-solutions.com> on 2003/12/05 09:35:47 UTC

Newbie question on compile

Hi all, I am new in using maven and try to do a simple java compile of
an existing project.
 
The old ant build include classpath with the following code : 
------------------------------------------------------------------------
-----------------------------------------
    <javac destdir="${build}" verbose="false" deprecation="true"
debug="on">
        <src path="${src}" />
        <classpath>
            <pathelement path="${j2ee.lib};${dependencies}" />
            <fileset dir="../libs">
                <include name="*.jar" />
            </fileset>
        </classpath>
    </javac>
------------------------------------------------------------------------
-----------------------------------------
 
I create the folowing maven project : 
------------------------------------------------------------------------
-----------------------------------------
<?xml version="1.0"?>
 
<project>
    <pomVersion>3</pomVersion>
    <id>common</id>
 
    <build>    
        <sourceDirectory>src</sourceDirectory>
    </build>
    
    <dependencies>
        <dependency>
            <groupId>Prima Solutions</groupId>
            <artifactId>libs</artifactId>
            <jar>foo1.jar</jar>
            <jar>foo2.jar</jar>
            ...
            <jar>fooN.jar</jar>
            <url>../libs/</url>
        </dependency>
    </dependencies>
</project>
------------------------------------------------------------------------
-----------------------------------------
 
But i can't put a wild cards in the jar tag like <jar>*.jar</jar> to
avoid to list all the jars !
 
How can i do that.
 
Thanks for your respnses and sorry for my poor english !
 
Stephane

Re: Newbie question on compile

Posted by rh...@free.fr.
Stephane,

a <dependency> element represents a single dependency (e.g. a single tld file, a
single jar, etc.), thus to specify several library dependencies you have to
declare one <dependency> element per jar like below :

<dependencies>
  <dependency>
    <groupId>Prima Solutions</groupId>
    <artifactId>foo1.jar</artifactId>
  <dependency>
  <dependency>
    <groupId>Prima Solutions</groupId>
    <artifactId>foo2.jar</artifactId>
  <dependency>
<dependencies>

Also to tell Maven that a given dependency shouldnot be looked up in the
repository but instead in a particular location you have to use jar overriding
feature. indeed the <jar> element is used to specify that the artifact is
expected to be found in the repository under the name specified in the <jar>
element (clearly thats not the case here). 

To enable jar overriding you have to add maven.jar.override=true in you
project.properties and foreach overriden dependency jar add the following
property : maven.jar.<artifactId> = ${path.to.artifact}, for instance : 

maven.jar.foo1 = ${basedir}/../lib/foo1.jar


please refer to
http://maven.apache.org/reference/user-guide.html#Overriding%20Stated%20Dependencies
for more details and also to
http://maven.apache.org/reference/project-descriptor.html#dependencies for the
semantic of the <jar> element

hope this helps.

-- gd

Quoting Stéphane Philippart <st...@prima-solutions.com>:

>     <dependencies>
>         <dependency>
>             <groupId>Prima Solutions</groupId>
>             <artifactId>libs</artifactId>
>             <jar>foo1.jar</jar>
>             <jar>foo2.jar</jar>
>             ...
>             <jar>fooN.jar</jar>
>             <url>../libs/</url>
>         </dependency>
>     </dependencies>
>  
> But i can't put a wild cards in the jar tag like <jar>*.jar</jar> to
> avoid to list all the jars !
>  
> How can i do that.
>  
> Thanks for your respnses and sorry for my poor english !
>  
> Stephane
> 



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