使用Maven Spock的JDK 10.0.2无法执行目标

时间:2018-08-27 10:48:07

标签: java groovy spock geb

我正在使用geb spock。它在JDK 1.8上运行良好,但是当我移至JDK10时,这给我带来了问题。

以下是系统详细信息: openjdk版本“ 10.0.2” 2018-07-17 操作系统:Linux

下面是pom.xml。 (这在JDK 1.8上可以正常工作,但在10上则不能)

for row in results1:
    print(row['SALES'])

我面临的错误:

<project >

    <properties>
        <skipITTests>false</skipITTests>
        <geb.version>2.1</geb.version>
        <selenium.version>3.9.1</selenium.version>
        <groovy.version>2.4.15</groovy.version>
        <spock.version>1.1-groovy-2.4</spock.version>
        <gson.version>2.8.2</gson.version>
        <httpclient.version>4.3.4</httpclient.version>
        <httpcore.version>4.3.2</httpcore.version>
        <surefire.plugin.version>2.22.0</surefire.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Groovy compiler for Spock/Geb tests -->
        <version.groovy-eclipse-compiler>2.9.2-01</version.groovy-eclipse-compiler>
        <version.groovy-eclipse-batch>2.4.3-01</version.groovy-eclipse-batch>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.gebish</groupId>
            <artifactId>geb-spock</artifactId>
            <version>${geb.version}</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.gebish/geb-core -->
        <dependency>
            <groupId>org.gebish</groupId>
            <artifactId>geb-core</artifactId>
            <version>${geb.version}</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>${selenium.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4</version>
        </dependency>
        <dependency>
            <groupId>com.mailosaur</groupId>
            <artifactId>mailosaur-java</artifactId>
            <version>5.0.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <!--<scope>test</scope>-->
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

        <!--Dependencies related to GEB SPOCK reporting-->
        <dependency>
            <groupId>com.athaydes</groupId>
            <artifactId>spock-reports</artifactId>
            <version>1.3.1</version>
            <scope>test</scope>
            <!-- this avoids affecting your version of Groovy/Spock -->
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${groovy.version}</version>
        </dependency>

        <!-- // if you don't already have slf4j-api and an implementation of it in the classpath, add this! -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
        <!-- This dependency is for support of Junit latest version -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/ru.yandex.qatools.ashot/ashot -->
        <dependency>
            <groupId>ru.yandex.qatools.ashot</groupId>
            <artifactId>ashot</artifactId>
            <version>1.5.4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
        <dependency>
            <groupId>com.codeborne</groupId>
            <artifactId>phantomjsdriver</artifactId>
            <version>1.4.4</version>
        </dependency>

        <!-- Apache POI dependencies in case required while reading Excel sheets -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>ooxml-schemas</artifactId>
            <version>1.3</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.17</version>
            <scope>compile</scope>
        </dependency>
        <!-- End :  POI dependencies -->

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.plugin.version}</version>
                <dependencies>                   
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>${surefire.plugin.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <skipTests>${skipITTests}</skipTests>
                    <includes>
                        <include>*Spec.*</include>
                    </includes>
                    <systemPropertyVariables>
                        <geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
                    </systemPropertyVariables>
                    <!-- Surefire 2.14 and above configuration for parallelization-->
                    <parallel>classes</parallel>
                    <forkCount>4</forkCount>
                    <reuseForks>false</reuseForks>
                    <useUnlimitedThreads>true</useUnlimitedThreads>
                </configuration>
            </plugin>



            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>             
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>${version.groovy-eclipse-compiler}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>${version.groovy-eclipse-batch}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>${version.groovy-eclipse-compiler}</version>
                <extensions>true</extensions>
            </plugin>

        </plugins>
    </build>

</project>

请指导我需要在maven编译器插件中进行哪些更改才能解决它。

1 个答案:

答案 0 :(得分:2)

Spock 1.2中正在进行支持Java 10+的工作,您可以签出当前的spock-1.2-RC3-groovy-2.5版本。

相关问题