exec-maven-plugin exec:java failing: Cannot assign configuration values to array of type java.lang.String

David Camilleri picture David Camilleri · Apr 17, 2012 · Viewed 13k times · Source

When executing mvn exec:java it fails to correctly parse the configuration arguments, throwing the following error:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project autotest-programmes: Unable to parse configuration of mojo org.codehaus.mojo:exec-maven-plugin:1.2.1:java: Cannot assign configuration values to array of type java.lang.String: [-classpath, Classpath {}, --glue, com.company.test.cucumber, --format, pretty, --format, html:C:\workspace\autotest\target] -> [Help 1]

This is the plugin configuration used (using Apache Maven 3.0.3):

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.2.1</version>
    <executions>
        <execution>
            <goals>
                <goal>java</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <includeProjectDependencies>false</includeProjectDependencies>
        <includePluginDependencies>true</includePluginDependencies>
        <executableDependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
        </executableDependency>
        <mainClass>cucumber.cli.Main</mainClass>
        <commandlineArgs>-Dfile.encoding=UTF-8</commandlineArgs>
        <arguments>
            <argument>-classpath</argument>
            <classpath/>
            <argument>--glue</argument>
            <argument>com.company.test.cucumber</argument>
            <argument>--format</argument>
            <argument>pretty</argument>
            <argument>--format</argument>
            <argument>html:${project.basedir}\target</argument>
        </arguments>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>1.0.2</version>
        </dependency>
    </dependencies>
</plugin>

Answer

khmarbaise picture khmarbaise · Apr 17, 2012

I would suggest to remove the empty entries from your configuration and try it again.

 <argument>-classpath</argument>
 <classpath/>

Cause in java goal the classpath is not allowed based on the documentation.

BTW: Never use "\" in your maven pom. Use forward slashes instead.