You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Moss <mo...@googlemail.com> on 2009/01/19 16:05:15 UTC

Plugin not picking up dependencies when executed from parent pom?

Hi,

I'm trying to use the ant-run plugin to execute a sql script as part of my
build.

It's working perfectly, as long as I build the project directly.  If I try
to built the project as a module from a parent pom, the plugin fails with
the error:
"Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/derby/tools/ij"

Does anyone know what's wrong?  Any help would be greatly appreciated.

The parent pom doesn't contain anything other than module definitions and
some surefire configuration.  Here's the relevant part of the project's pom
though:

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>create-demo-database</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <java classpathref="maven.plugin.classpath"
classname="org.apache.derby.tools.ij"
                                    fork="true"
dir="${project.build.directory}">
                                    <arg
value="${project.basedir}/database/create-database.sql" />
                                </java>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbytools</artifactId>
                        <version>10.4.2.0</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derby</artifactId>
                        <version>10.4.2.0</version>
                    </dependency>
                </dependencies>
            </plugin>


Thanks,
Dave.

Re: Plugin not picking up dependencies when executed from parent pom?

Posted by Wayne Fay <wa...@gmail.com>.
> It's working perfectly, as long as I build the project directly.  If I try
> to built the project as a module from a parent pom, the plugin fails with
> the error:
> "Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/derby/tools/ij"

In M2.0, the "first" declaration of a plugin "wins". So add the derby
and derbytools dependencies to the other places where you declare
maven-antrun-plugin, probably in the parent somewhere I'd imagine.
This is a bug that is being worked on but won't be resolved for the
2.0 line, as I understand it.

Wayne

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