简体   繁体   English

Intellij gradle kotlin 项目在 java 和 kotlin 目录中生成 .class 文件

[英]Intellij gradle kotlin project generate .class files in both java and kotlin directory

I have a Gradle Kotlin project setup in Intellij,我在 Intellij 中有一个 Gradle Kotlin 项目设置,

The source directory is as follows:源码目录如下:

src
  main
    kotlin
    resource
  test
    kotlin
    resource

When I run from command line gradlew build , the .class files are only generated under ./build/classes/kotlin/main/com/当我从命令行gradlew build运行时,.class 文件仅在./build/classes/kotlin/main/com/下生成

But if I run build task from Intellij Gradle panel, it generated .class files under both但是,如果我从 Intellij Gradle 面板运行构建任务,它会在两者下生成 .class 文件

./build/classes/kotlin/main/com/
./build/classes/java/main/com/

It causes errors on further Gradle tasks.它会导致进一步的 Gradle 任务出错。

Since Gradle command line gives me expected result, I am assuming this is an issue related to the Intellij setting/bug.由于 Gradle 命令行给了我预期的结果,我假设这是与 Intellij 设置/错误有关的问题。

How can I tell Intellij only generate .class file under ./build/class/kotlin folder?如何告诉 Intellij 仅在./build/class/kotlin文件夹下生成 .class 文件?

I am using IntelliJ IDEA 2022.1 (Ultimate Edition).我正在使用 IntelliJ IDEA 2022.1(终极版)。

This must because of some temp issue specific to my local project setting, as I can't reproduce this problem by recreating the project locally from the scrach, closing this issue.这一定是因为我的本地项目设置特有的一些临时问题,因为我无法通过从头开始在本地重新创建项目来重现此问题,关闭此问题。

Please ignore this question.请忽略这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM