Получение java.lang.IllegalArgumentException при обновлении огуречно-заводной версии в файле POM - PullRequest
0 голосов
/ 28 октября 2019

При обновлении версии cucumber-groovy в моем POM-файле с 4.2.0 до 4.7.0

java.lang.IllegalArgumentException: The glue path contained invalid identifiers target/test-classes
    at io.cucumber.core.model.GluePath.parseAssumeClasspathScheme (GluePath.java:84)
    at io.cucumber.core.model.GluePath.parse (GluePath.java:53)
    at io.cucumber.core.options.RuntimeOptionsParser.parse (RuntimeOptionsParser.java:85)
    at io.cucumber.core.options.CommandlineOptionsParser.parse (CommandlineOptionsParser.java:25)
    at io.cucumber.core.options.CommandlineOptionsParser.parse (CommandlineOptionsParser.java:29)
    at io.cucumber.core.cli.Main.run (Main.java:29)
    at io.cucumber.core.cli.Main.main (Main.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.329 s
[INFO] Finished at: 2019-10-28T19:17:41+11:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default) on project sample-test: An exception occured while executing the Java class. The glue path contained invalid identifiers target/test-classes -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

я получаю следующее исключение. Это раздел файла POM, в котором происходит ошибка. генерируется из (я считаю)

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>test</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <classpathScope>test</classpathScope>
                            <mainClass>io.cucumber.core.cli.Main</mainClass>    <!-- NEEDED FOR cucumber-groovy version 4.7.1 -->
                            <!--<mainClass>cucumber.api.cli.Main</mainClass>--> <!-- NEEDED FOR cucumber-groovy version 4.2.0 -->
                            <arguments>
                                <argument>--plugin</argument>
                                <argument>json:reports/junit.json</argument>
                                <argument>--strict</argument>
                                <argument>--glue</argument>
                                <argument>target/test-classes</argument>
                                <argument>target/test-classes/.</argument>
                                <argument>--tags</argument>
                                <argument>${tagArg}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

А вот раздел свойств файла POM

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <cluecumber-report-plugin.version>2.3.1</cluecumber-report-plugin.version>
        <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
        <maven-clean-plugin.version>3.1.0</maven-clean-plugin.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
        <ocular.version>1.0.0.Alpha</ocular.version>
        <groovycsv.version>1.3</groovycsv.version>
        <ashot.version>1.5.4</ashot.version>
        <webdrivermanager.version>3.7.1</webdrivermanager.version>
        <com4j.version>2.1</com4j.version>
        <geb-core.version>3.2</geb-core.version>
        <http-builder.version>0.7.1</http-builder.version>
        <commons-io.version>2.6</commons-io.version>
        <selenium-api.version>3.141.59</selenium-api.version>
        <selenium-java.version>3.141.59</selenium-java.version>
        <slf4j-simple.version>1.7.28</slf4j-simple.version>
        <cucumber-jvm.version>4.8.0</cucumber-jvm.version>
        <cucumber-groovy.version>4.7.0</cucumber-groovy.version>
        <groovy-all.version>2.5.8</groovy-all.version>
    </properties>

Этот же файл POM работает нормально при использовании cucumber-groovy версии 4.2.0,Есть ли другой способ указать код клея для более новой версии cucumber-groovy?

Я пытался использовать следующее, но ни одно из них не помогло.

target.test-classes
target
test-classes

Моя структура папок

src\test\resources\features
src\test\resources\step_definitions

Любая помощь очень важна. Спасибо!

Ответы [ 2 ]

1 голос
/ 28 октября 2019

Вы в настоящее время передаете свой клей как --glue target/test-classes target/test-classes/. Однако ваш клей должен быть либо именем пакета, либо путем к классу URI. Для доступа к ресурсам в безымянном пакете вы можете использовать --glue classpath:.

0 голосов
/ 28 октября 2019

обновить файл POM и заменить --glue target/test-classes target/test-classes/. на --glue classpath: classpath:/.

...