sure:

this is the pom.xml for the maven-jdbc-plugin...notice there are not
dependencies for a database driver in the plugin pom itself.

<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>mojo</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>1.0.1</version>
</parent>
<artifactId>maven-jdbc-plugin</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Maven JDBC Plugin</name>
<inceptionYear>2005</inceptionYear>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0-beta-1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

and here is the pom.xml for something that is using the plugin:

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>g</groupId>
<artifactId>g-db</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>g - db plugin playground</name>
<parent>
<groupId>g</groupId>
<artifactId>g</artifactId>
<version>1.0</version>
</parent>
<dependencies>
<dependency>
<groupId>oracle</groupId>
<artifactId>oracle</artifactId>
<version>9201</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>oracle_nls_charset</artifactId>
<version>9201.12</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<artifactId>oracle</artifactId>
<groupId>oracle</groupId>
<version>9201</version>
</extension>
<extension>
<artifactId>oracle_nls_charset</artifactId>
<groupId>oracle</groupId>
<version>9201.12</version>
</extension>
</extensions>
<plugins>
<plugin>
<artifactId>maven-jdbc-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:@host:1790:DB</url>
<username>user</username>
<password>password</password>
<statement>select * from whatever</statement>
</configuration>
</plugin>
</plugins>
</build>
</project>


now, the <dependency> entries would in available to compile against for
sources that might be in this subproject..but they would not be available to
the plugin execution classpath. But with the <extensions> mechanism the
plugin would be able to find the oracle.jdbc.driver.OracleDriver class since
those extensions are inserted into the plugin exec classpath

in a nutshell it can boil down to

extensions let you insert an artifact into the classpath of a plugin when it
executes

that clear it up further?

jesse

On 9/22/05, dohadwala, moiz <[EMAIL PROTECTED]> wrote:
>
> Jesse,
>
> Thanks for the explanation. To make it clearer, can you show me what the
> extension tag would look like in this case?
>
> Thanks,
>
> -Moiz
>
> -----Original Message-----
> From: Jesse McConnell [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 22, 2005 7:25 AM
> To: Maven Users List
> Subject: Re: [m2] project descriptor tags
>
> I can give you a use case where you would need extensions.
>
> there is a jdbc plugin that lets you execute whatever sql you want when
> you
> execute the plugin. But the way the plugin was built you can't just
> declare
> every database driver as a dependency of the plugin...that would mean
> people
> would need to download oracle drivers and install them just to use mysql..
>
> so you use extensions so that you can insert the database driver code at
> runtime of the plugin..
>
> does that case clear up what extensions can be used for?
>
> jesse
>
> On 9/22/05, dohadwala, moiz <[EMAIL PROTECTED]> wrote:
> >
> > I am new to maven and have decided to take the plunge with m2. I have
> > trying to understand the pom.xml tags. I don't understand the purpose
> > of the extension tag. The description on
> > http://maven.apache.org/maven2/maven-model/maven.html#class_Extension
> > <http://maven.apache.org/maven2/maven-model/maven.html#class_Extension
> > >
> > isn't too clear.
> >
> > Is there any other location I can use for reference?
> >
> > -Moiz
> >
> >
> >
> >
>
>
> --
> jesse mcconnell
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
jesse mcconnell

Reply via email to