具有Kotlin类的Jenkins和Java项目-编译错误

我有一个Java项目,在其中插入了Kotlin类。在本地,Java类可以实例化并调用Kotlin对象,而不会出现问题。但是,当我将其推送给Jenkins时,它失败并显示一个错误,导致我怀疑Java kode调用它时Kotlin代码没有被编译。

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /tmp/workspace/5934_e2e_esoknad-oppforing-bolig/startlan-esoknad-   
backend/startlan-esoknad-selenium/src/test/java/e2e/cucumber/soknad
/bakgrunn/oppfore/OppforeSteps.java:[15,5] cannot find symbol
symbol:   class OppforePageK
location: class e2e.cucumber.soknad.bakgrunn.oppfore.OppforeSteps

令人反感的Java代码:

OppforePageK oppforePageK = new OppforePageK();

要使Kotlin正常工作,我只允许IntelliJ安装插件并自动配置项目。但是,pom.xlm文件中的kotlin条目似乎是正确的,因此我看不出任何不应该编译的明显原因。

<properties>
    <e2e.rammeverk.versjon>19.3</e2e.rammeverk.versjon>
    <selenium.jackson.version>2.7.1</selenium.jackson.version>
                <kotlin.version>1.3.50</kotlin.version>
</properties>

<dependency>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-stdlib-jdk8</artifactId>
    <version>${kotlin.version}</version>
</dependency>

<dependency>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-stdlib-jdk8</artifactId>
    <version>${kotlin.version}</version>
</dependency>
<dependency>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-test</artifactId>
    <version>${kotlin.version}</version>
    <scope>test</scope>
</dependency>

<plugin>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-maven-plugin</artifactId>
    <version>${kotlin.version}</version>
    <executions>
        <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
        <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <jvmTarget>1.8</jvmTarget>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <executions>
        <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
        <execution>
            <id>testCompile</id>
            <phase>test-compile</phase>
            <goals>
                <goal>testCompile</goal>
            </goals>
         </execution>
      </executions>

有什么想法吗?

worinima1 回答:具有Kotlin类的Jenkins和Java项目-编译错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3152888.html

大家都在问