Невозможно запустить тесты с помощью build-helper-maven-plugin для проекта Groovy - PullRequest
0 голосов
/ 26 сентября 2018

У меня отличный проект в Eclipse.Мне нужно перейти с Gradle на Maven, и теперь я не могу запустить существующие в нем тесты.

Вот структура проекта:

enter image description here

Вот содержимое файла pom.xml:

    <dependencies>
    ...
    <dependency>
        <groupId>org.spockframework</groupId>
        <artifactId>spock-core</artifactId>
        <version>1.0-groovy-2.4</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <compilerId>groovy-eclipse-compiler</compilerId>
                <compilerArguments>
                    <indy />
                    <!-- optional; supported by batch 2.4.12-04+ -->
                ...
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.12</version>
            <executions>
                <execution>
                    <id>add-source</id>
                    ...
                </execution>
                <execution>
                    <id>add-test-source</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>add-test-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>src/test/groovy</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>

</build>

Однако, если я выполняю чистую установку mvn, тесты не запускаются.Вот вывод консоли:

enter image description here

1 Ответ

0 голосов
/ 26 сентября 2018

Тестовые случаи у нас называются Spec, а не Test, это исправлено так:

    <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.22.0</version>
            <configuration>
                <includes>
                    <include>**/*Spec.class</include>
                </includes>
            </configuration>
        </plugin>
...