You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Renato Primavera <re...@skynet.be> on 2003/01/26 15:55:53 UTC

How can I include personnal JARs ?

    Hello All,


I'm trying to add a personal JAR, called "myownjar.jar" to my 
project.xml file, but when I try to compile this project with the "maven 
java:compile" command, the JAR seems not to be included.
It results some compilation errors...

Is something wrong in my <build> declaration ?

  <build>
      <sourceDirectory>src/java/main</sourceDirectory>
      <unitTestSourceDirectory>src/java/test</unitTestSourceDirectory>
      <jars>
          <jar>lib/myownjar.jar</jar>
      </jars>
  </build>

Thanks in advance,

RP

-- 
-----
PRIMAVERA Renato, Belgium
GSM : + 32 (0) 497 92 92 46
E-Mail : renato.primavera@skynet.be
CV : http://membres.lycos.fr/primaverar/cv.pdf
-----
" Un Bug ? Utilisez Baygon ! "
-----
--




Re: How can I include personnal JARs ?

Posted by Ben Walding <be...@walding.com>.
The way I like to do things is have an area in my project

eg.
packages/myjar/jars/myjar-1.0.jar

Then as a preGoal to java:compile I just copy everything under packages 
across to the local maven repository (${maven.home}/repository I think)
And then business as usual with dependencies...

Thus whenever anyone checks the project out from CVS, the project fills 
the repository appropriately...

Paul Libbrecht wrote:

> It should be added that making a local repository is the solution of 
> choice for such a thing, isn't it ?
>
> Paul
>
>
> Le Dimanche, 26 janv 2003, à 16:41 Europe/Berlin, Jason van Zyl a écrit :
>
>>> The question is : how can I add a personal JAR in the classpath before
>>> maven compile my java files ?
>>>
>>> Greetings,
>>
>>
>> Look at the <dependencies/> section of any number of project.xml files.
>> That's where you define your project dependencies that contribute to the
>> classpath used to compile your project sources.
>
>
>
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
>
>



Re: How can I include personnal JARs ?

Posted by Paul Libbrecht <pa...@activemath.org>.
It should be added that making a local repository is the solution of 
choice for such a thing, isn't it ?

Paul


Le Dimanche, 26 janv 2003, à 16:41 Europe/Berlin, Jason van Zyl a écrit 
:

>> The question is : how can I add a personal JAR in the classpath before
>> maven compile my java files ?
>>
>> Greetings,
>
> Look at the <dependencies/> section of any number of project.xml files.
> That's where you define your project dependencies that contribute to 
> the
> classpath used to compile your project sources.


Re: How can I include personnal JARs ?

Posted by Jason van Zyl <ja...@zenplex.com>.
On Sun, 2003-01-26 at 10:33, Renato Primavera wrote:
> I've tried this in the maven.xml :
> 
>       <preGoal name="java:compile">
>           <copy file="lib/myownjar.jar" todir="${maven.build.dest}"/>
>       </preGoal>
> 
> The JAR file is well copied into the target directory, but my problem is 
> not solved.
> In fact, I need include my JAR file to compile classes which are in my 
> src/java/main directory.
> The question is : how can I add a personal JAR in the classpath before 
> maven compile my java files ?
> 
> Greetings,

Look at the <dependencies/> section of any number of project.xml files.
That's where you define your project dependencies that contribute to the
classpath used to compile your project sources.

If you don't want to use your own local repository put the following in
your project.properties file:

maven.jar.override = on
maven.jar.myownjar = ${basedir}/lib/myownjar.jar

For this to work you must have a dependency like:

<dependencies>
  <dependency>
    <id>myownjar</id>
    <version>WILL BE IGNORED DUE TO THE OVERRIDE</version>
  </dependency>
</dependencies>

And maven will use the location you specified for myownjar and put it in
the classpath.

> RP
> 
> 
> Jason van Zyl wrote:
> 
> >On Sun, 2003-01-26 at 09:55, Renato Primavera wrote:
> >  
> >
> >>    Hello All,
> >>
> >>
> >>I'm trying to add a personal JAR, called "myownjar.jar" to my 
> >>project.xml file, but when I try to compile this project with the "maven 
> >>java:compile" command, the JAR seems not to be included.
> >>It results some compilation errors...
> >>
> >>Is something wrong in my <build> declaration ?
> >>
> >>  <build>
> >>      <sourceDirectory>src/java/main</sourceDirectory>
> >>      <unitTestSourceDirectory>src/java/test</unitTestSourceDirectory>
> >>      <jars>
> >>          <jar>lib/myownjar.jar</jar>
> >>      </jars>
> >>  </build>
> >>    
> >>
> >
> ><jars/> is a dead element.
> >
> >You must use a preGoal to copy JARs into the final JAR:
> >
> ><preGoal name="java:jar">
> >  <copy file="myown.jar" todir="${maven.build.dest}"/>
> ></preGoal>
> >
> >  
> >
> >>Thanks in advance,
> >>
> >>RP
> >>    
> >>
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


Re: How can I include personnal JARs ?

Posted by Renato Primavera <re...@skynet.be>.
I've tried this in the maven.xml :

      <preGoal name="java:compile">
          <copy file="lib/myownjar.jar" todir="${maven.build.dest}"/>
      </preGoal>

The JAR file is well copied into the target directory, but my problem is 
not solved.
In fact, I need include my JAR file to compile classes which are in my 
src/java/main directory.
The question is : how can I add a personal JAR in the classpath before 
maven compile my java files ?

Greetings,

RP


Jason van Zyl wrote:

>On Sun, 2003-01-26 at 09:55, Renato Primavera wrote:
>  
>
>>    Hello All,
>>
>>
>>I'm trying to add a personal JAR, called "myownjar.jar" to my 
>>project.xml file, but when I try to compile this project with the "maven 
>>java:compile" command, the JAR seems not to be included.
>>It results some compilation errors...
>>
>>Is something wrong in my <build> declaration ?
>>
>>  <build>
>>      <sourceDirectory>src/java/main</sourceDirectory>
>>      <unitTestSourceDirectory>src/java/test</unitTestSourceDirectory>
>>      <jars>
>>          <jar>lib/myownjar.jar</jar>
>>      </jars>
>>  </build>
>>    
>>
>
><jars/> is a dead element.
>
>You must use a preGoal to copy JARs into the final JAR:
>
><preGoal name="java:jar">
>  <copy file="myown.jar" todir="${maven.build.dest}"/>
></preGoal>
>
>  
>
>>Thanks in advance,
>>
>>RP
>>    
>>


-- 
-----
PRIMAVERA Renato, Belgium
GSM : + 32 (0) 497 92 92 46
E-Mail : renato.primavera@skynet.be
CV : http://membres.lycos.fr/primaverar/cv.pdf
-----
" Un Bug ? Utilisez Baygon ! "
-----
--




Re: How can I include personnal JARs ?

Posted by Jason van Zyl <ja...@zenplex.com>.
On Sun, 2003-01-26 at 09:55, Renato Primavera wrote:
>     Hello All,
> 
> 
> I'm trying to add a personal JAR, called "myownjar.jar" to my 
> project.xml file, but when I try to compile this project with the "maven 
> java:compile" command, the JAR seems not to be included.
> It results some compilation errors...
> 
> Is something wrong in my <build> declaration ?
> 
>   <build>
>       <sourceDirectory>src/java/main</sourceDirectory>
>       <unitTestSourceDirectory>src/java/test</unitTestSourceDirectory>
>       <jars>
>           <jar>lib/myownjar.jar</jar>
>       </jars>
>   </build>

<jars/> is a dead element.

You must use a preGoal to copy JARs into the final JAR:

<preGoal name="java:jar">
  <copy file="myown.jar" todir="${maven.build.dest}"/>
</preGoal>

> Thanks in advance,
> 
> RP
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society