You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Marco Mistroni <mm...@gmail.com> on 2011/11/19 19:25:20 UTC

trying to create a maven plugin for running FolderRunner

hi all
  i have successfully ran the FolderRunner from my maven project with this
configuration

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <dependencies>
                </dependencies>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <classpathScope>test</classpathScope>
                    <mainClass>fitlibrary.runner.FolderRunner</mainClass>
                    <arguments>
                        <argument>src/main/resources/fit</argument>
                        <argument>target/fit</argument>
                    </arguments>
                </configuration>
            </plugin>

Now, i have tried to create my own Maven plugin:

public class EchoMojo extends AbstractMojo
{
    /**
     * Any Object to print out.
     * @parameter expression="${message}" default-value="Hello World..."
     */
    private Object message;

    /**
     * Any Object to print out.
     * @parameter expression="${fitDirectory}"
default-value="FitDirectory..."
     */
    private String fitDirectory;
    /**
     * Any Object to print out.
     * @parameter expression="${reportDirectory}"
default-value="OutputDirectory.."
     */
    private String reportDirectory;


    public void execute()
        throws MojoExecutionException, MojoFailureException
    {

        try {
            getLog().info( "FitDirectory:" + fitDirectory );
            getLog().info( "OutputDirectory:" + reportDirectory);

            FolderRunner folderRunner = new FolderRunner();
            Report report = folderRunner.run(fitDirectory, reportDirectory);

            getLog().info(report.getCounts());


        } catch(Exception e) {
            getLog().error("Exception in running plugin", e);
        }

    }
}

and trying to run it this way:
<plugin>
                <groupId>com.worldcorpservices.plugins</groupId>
                <artifactId>maven-fit-plugin</artifactId>
                <version>1.0-SNAPSHOT</version>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>run-fit</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <message>This is message from configuring pluginmy
simple msg</message>
                    <fitDirectory>src/main/resources/fit</fitDirectory>
                    <reportDirectory>target/fit</reportDirectory>
                </configuration>
            </plugin>

The FolderRunner runs , however i am getting this exceptions:

Missing class or Missing method. Possibly:

   - public Type getComDotOmDotExampleDotDvrDotFixturesDotCreatePrograms()
   { }
   - public Type comDotOmDotExampleDotDvrDotFixturesDotCreatePrograms() { }

so it appears it cannot find the classes in the current project....... i am
guessing it has to do with forking  and was wondering if anyone here has
find similar problems...

w/kindest regards
 marco