Another question: it seems that I cannot use this "exec" plug-in in
"pre-clean" phase. When I tried, I got NullPointerException from maven as
belows:

>mvn clean
[INFO] Scanning for projects...
WAGON_VERSION: 1.0-beta-2
[INFO]
----------------------------------------------------------------------------
[INFO] Building Data Access Specific
[INFO]    task-segment: [clean]
[INFO]
----------------------------------------------------------------------------
[INFO] Preparing exec:java
[WARNING] Removing: java from forked lifecycle, to prevent recursive
invocation.
[WARNING] Removing: java from forked lifecycle, to prevent recursive
invocation.
[INFO] No goals needed for project - skipping
[INFO] [exec:java {execution: default}]
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/C:/Program Files/Apache Software Fundation/maven-2.0.7
/bin/../lib/maven-core-2.0.7-uber.jar
---------------------------------------------------
java.lang.NullPointerException
        at
org.apache.maven.usability.MojoExecutionExceptionDiagnoser.diagnose(
MojoExecutionExceptionDiagnoser.java:64)
        at org.apache.maven.usability.diagnostics.ErrorDiagnostics.diagnose(
ErrorDiagnostics.java:84)
        at org.apache.maven.DefaultMaven.logDiagnostics(DefaultMaven.java
:727)
        at org.apache.maven.DefaultMaven.logError(DefaultMaven.java:672)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:131)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java
:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

here is the snippet of my definition xml:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>pre-clean</phase>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>


On 9/18/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
>
> Try adding the mysql dependency to the plugin itself. Seems like the
> exec plugin is not inheriting the test classpath, only the compile
> classpath.
>
> Wayne
>
> On 9/18/07, Yan Huang <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > I have a situation where i define "mysql" dependency with "test" scope
> as
> > belows:
> >
> >    <dependency>
> >      <groupId>mysql</groupId>
> >      <artifactId>mysql-jdbc-connector</artifactId>
> >      <version>5.0.3</version>
> >      <scope>test</scope>
> >    </dependency>
> >
> > According to the spec, this jar will be included in the classpath of
> test
> > compilation and execution. However, when I'm using maven exec plug-in to
> > prepare some test tables installation in MySQL DB with the "default"
> > classpath as part of "test-compile" phase:
> >
> >      <plugin>
> >        <groupId>org.codehaus.mojo</groupId>
> >        <artifactId>exec-maven-plugin</artifactId>
> >        <executions>
> >          <execution>
> >            <phase>test-compile</phase>
> >            <goals>
> >              <goal>java</goal>
> >            </goals>
> >          </execution>
> >        </executions>
> >        <configuration>
> >          <mainClass>myexample.foo.test</mainClass>
> >          <arguments>
> >            <argument>install</argument>
> >          </arguments>
> >       </configuration>
> >   </plugin>
> >
> > The "mvn test-compile" failed to find "mysql-jdbc-connector-5.0.3.jar",
> > which suggested that this jar was not available during "test-compile"
> phase.
> > After removing "test" scope of that dependency, test-compile phase went
> > through fine.
> >
> > Did anyone observe the similar behavior? was the test-scoped dependency
> > really not available in "test-compile" phase?
> >
> > Thanks
> > Yan
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to