Не удалось выполнить цель с JDK 10.0.2 с maven spock - PullRequest
0 голосов
/ 27 августа 2018

Я использую geb spock. Он отлично работал с JDK 1.8, однако, когда я перешел на JDK10, у меня возникли проблемы.

Ниже приведены сведения о системе: openjdk версия "10.0.2" 2018-07-17 ОС: Linux

Ниже приведен pom.xml. (Это работает нормально с JDK 1.8, но не с 10)

<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>

Ошибки, с которыми я сталкиваюсь:

The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

Подскажите, пожалуйста, какие изменения мне нужно внести в плагин компилятора maven, чтобы решить его.

1 Ответ

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

В Spock 1.2 ведется работа по поддержке Java 10+, вы можете ознакомиться с текущей версией spock-1.2-RC3-groovy-2.5.

Смежные вопросы

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...