Hi,

I've got a fairly complex project, consisting of a couple of dozen modules
all up. What I'm finding is that certain combinations of these modules don't
build together, and I think it's because of dependencies in plugins.

Case in point: the application as a whole talks to two different databases -
a MySQL database and an Oracle database. Each database has a schema module,
which is responsible for creating tables, inserting data, and so on. If I
try to build a profile that contains both modules, I get an error.

The schema POMs look like this:


Oracle POM:

<project>
 <modelVersion>4.0.0</modelVersion>
 <groupId>net.twasink</groupId>
 <artifactId>oracle-schema</artifactId>
 <version>1.0-SNAPSHOT</version>
 <packaging>pom</packaging>
 <name>Oracle Schema</name>

 <build>
   <plugins>
     <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>sql-maven-plugin</artifactId>
       <dependencies>
         <dependency>
           <groupId>com.oracle</groupId>
           <artifactId>ojdbc</artifactId>
           <version>14</version>
         </dependency>
       </dependencies>
       <configuration>
         <delimiter>/</delimiter>
         <autocommit>true</autocommit>
         <driver>${database.driver}</driver>
         <url>${database.test.url}</url>
       </configuration>
       <executions>
...
       </executions>
     </plugin>
   </plugins>
</project>

MySQL Pom:

<project>
 <modelVersion>4.0.0</modelVersion>
 <groupId>net.twasink</groupId>
 <artifactId>mysql-schema</artifactId>
 <version>1.0-SNAPSHOT</version>
 <packaging>pom</packaging>
 <name>MySQL Schema</name>

 <build>
   <plugins>
     <plugin>
       <groupId>org.codehaus.mojo</groupId>
       <artifactId>sql-maven-plugin</artifactId>
       <dependencies>
         <dependency>
           <groupId>com.mysql</groupId>
           <artifactId>mysql-connector-java</artifactId>
           <version>5.0.5</version>
         </dependency>
       </dependencies>
       <configuration>
         <delimiter>/</delimiter>
         <autocommit>true</autocommit>
         <driver>${database.driver}</driver>
         <url>${database.test.url}</url>
       </configuration>
       <executions>
...
       </executions>
     </plugin>
   </plugins>
 </build>
</project>


Master POM:
<project>
 <modelVersion>4.0.0</modelVersion>
 <groupId>net.twasink</groupId>
 <artifactId>db-schema</artifactId>
 <version>1.0-SNAPSHOT</version>
 <packaging>pom</packaging>
 <name>Database Schemas</name>

 <modules>
   <module>oracle-schema</module>
   <module>mysql-schema</module>
 </modules>
</project>


When I try to run this sort of combination, I get this error:
<lots of log output, indicating the successful build of the Oracle schema>
[INFO]
----------------------------------------------------------------------------
[INFO] Building MySQL Schema
[INFO]    task-segment: [install]
[INFO]
----------------------------------------------------------------------------
[INFO] [sql:execute {execution: admin-sql}]
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Driver class not found: com.mysql.jdbc.Driver

[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 minutes 56 seconds
[INFO] Finished at: Tue Apr 24 16:27:56 EST 2007
[INFO] Final Memory: 15M/29M
[INFO]
------------------------------------------------------------------------


Nor is this limited to the SQL plugin - I've seen similar behaviour with the
Antrun plugin. It looks like the first time a plugin is encountered, the
dependencies for that plugin are set, and subsequent configurations are
ignored. Is this behaviour intentional, or a bug?

(I've tried this with Maven 2.0.5 and 2.0.6, BTW - same symptoms)

Thanks for any help. :)

--
              "Software is too expensive to build cheaply"
Robert Watkins           http://twasink.net/           [EMAIL PROTECTED]

Reply via email to