Maven2 build and package targets' classpath

2008-01-10 Thread Filipe David Manana
Hi,

I want to add a JAR archive to the CLASSPATH for the targets build/package.
I don't want to include that JAR archive in my final WAR file. I read the
documentation, and for that purpose I added in my pom.xml the following to
the  element:

   
  
oracle
oracle-jdbc
14
  


This artifact was successfully added by me doing:

mvn install:install-file
-Dfile=/opt/oracle/product/10g/jdbc/lib/ojdbc14.jar  -DgroupId=oracle
-DartifactId=oracle-jdbc  -Dversion=14  -Dpackaging=jar


Although when I run "mvn package" or "mvn compile" I get errors telling that
the packages/classes defined in that JAR archive were not found in the
classpath.

How can I achieve this?

Thank you.

-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.


Re: Maven2 build and package targets' classpath

2008-01-10 Thread Simon Kitching
 Filipe David Manana <[EMAIL PROTECTED]> schrieb:
> Hi,
> 
> I want to add a JAR archive to the CLASSPATH for the targets build/package.
> I don't want to include that JAR archive in my final WAR file. I read the
> documentation, and for that purpose I added in my pom.xml the following to
> the  element:
> 
>
>   
> oracle
> oracle-jdbc
> 14
>   
> 
> 
> This artifact was successfully added by me doing:
> 
> mvn install:install-file
> -Dfile=/opt/oracle/product/10g/jdbc/lib/ojdbc14.jar  -DgroupId=oracle
> -DartifactId=oracle-jdbc  -Dversion=14  -Dpackaging=jar
> 
> 
> Although when I run "mvn package" or "mvn compile" I get errors telling that
> the packages/classes defined in that JAR archive were not found in the
> classpath.
> 
> How can I achieve this?

I believe the "extensions" attribute is intended to make "dynamically 
discoverable" libraries available to maven plugins.

In your case, probably what you want is
  provided
which tells maven that the jar is needed for compilation and for tests, but 
that the environment the artifact will finally be deployed into already 
provides a copy of this so it should not be in the final bundle.

Or maybe scope "optional" is what you are looking for. Again, optional jars are 
not in the final bundle although they are present in the classpath for compile 
and test phases.

Regards,
Simon


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Maven2 build and package targets' classpath

2008-01-10 Thread Filipe David Manana
It works! :)
Thank you.

On 1/10/08, Simon Kitching <[EMAIL PROTECTED]> wrote:
>
>  Filipe David Manana <[EMAIL PROTECTED]> schrieb:
> > Hi,
> >
> > I want to add a JAR archive to the CLASSPATH for the targets
> build/package.
> > I don't want to include that JAR archive in my final WAR file. I read
> the
> > documentation, and for that purpose I added in my pom.xml the following
> to
> > the  element:
> >
> >
> >   
> > oracle
> > oracle-jdbc
> > 14
> >   
> > 
> >
> > This artifact was successfully added by me doing:
> >
> > mvn install:install-file
> > -Dfile=/opt/oracle/product/10g/jdbc/lib/ojdbc14.jar  -DgroupId=oracle
> > -DartifactId=oracle-jdbc  -Dversion=14  -Dpackaging=jar
> >
> >
> > Although when I run "mvn package" or "mvn compile" I get errors telling
> that
> > the packages/classes defined in that JAR archive were not found in the
> > classpath.
> >
> > How can I achieve this?
>
> I believe the "extensions" attribute is intended to make "dynamically
> discoverable" libraries available to maven plugins.
>
> In your case, probably what you want is
>   provided
> which tells maven that the jar is needed for compilation and for tests,
> but that the environment the artifact will finally be deployed into already
> provides a copy of this so it should not be in the final bundle.
>
> Or maybe scope "optional" is what you are looking for. Again, optional
> jars are not in the final bundle although they are present in the classpath
> for compile and test phases.
>
> Regards,
> Simon
>
>


-- 
Filipe David Manana,
[EMAIL PROTECTED]

Obvious facts are like secrets to those not trained to see them.