Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gradle创建一个空文件夹“build/kotlin/sessions”,为什么?当我删除它回来时,如何修复它?_Gradle_Kotlin_Intellij Idea - Fatal编程技术网

Gradle创建一个空文件夹“build/kotlin/sessions”,为什么?当我删除它回来时,如何修复它?

Gradle创建一个空文件夹“build/kotlin/sessions”,为什么?当我删除它回来时,如何修复它?,gradle,kotlin,intellij-idea,Gradle,Kotlin,Intellij Idea,我在Kotlin/Springboot中有一个多模块项目,采用Gradle构建。 我有一个文件夹build/kotlin/sessions,即使我删除了它,它也会一直出现 文件夹是什么?为什么在那里?我可以完全移除它,这样它就不会回来了吗 我的根设置.gradle.kts: pluginManagement { repositories { maven(url = "https://repo.spring.io/snapshot") maven(url

我在Kotlin/Springboot中有一个多模块项目,采用Gradle构建。 我有一个文件夹
build/kotlin/sessions
,即使我删除了它,它也会一直出现

文件夹是什么?为什么在那里?我可以完全移除它,这样它就不会回来了吗

我的根
设置.gradle.kts

pluginManagement {
    repositories {
        maven(url = "https://repo.spring.io/snapshot")

        maven(url = "https://repo.spring.io/milestone")

        gradlePluginPortal()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "org.springframework.boot") {
                useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
            }
        }
    }
}

rootProject.name = "ris_2.0_backend"
include("workflow")
include("messaging")
include("project")
include("restapi")
plugins {
    id("io.spring.dependency-management") version "1.0.8.RELEASE"
    kotlin("jvm") version "1.3.61" apply false
    kotlin("plugin.spring") version "1.3.61"
    kotlin("plugin.jpa") version "1.3.61"
}

subprojects {

    apply(plugin = "io.spring.dependency-management")

    repositories {
        jcenter()
    }

    dependencyManagement {
        imports {
            mavenBom("org.springframework.boot:spring-boot-dependencies:2.1.8.RELEASE") {
                bomProperty("kotlin.version", "1.3.61")
            }
        }
    }



}
我的根
build.gradle.kts

pluginManagement {
    repositories {
        maven(url = "https://repo.spring.io/snapshot")

        maven(url = "https://repo.spring.io/milestone")

        gradlePluginPortal()
    }
    resolutionStrategy {
        eachPlugin {
            if (requested.id.id == "org.springframework.boot") {
                useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}")
            }
        }
    }
}

rootProject.name = "ris_2.0_backend"
include("workflow")
include("messaging")
include("project")
include("restapi")
plugins {
    id("io.spring.dependency-management") version "1.0.8.RELEASE"
    kotlin("jvm") version "1.3.61" apply false
    kotlin("plugin.spring") version "1.3.61"
    kotlin("plugin.jpa") version "1.3.61"
}

subprojects {

    apply(plugin = "io.spring.dependency-management")

    repositories {
        jcenter()
    }

    dependencyManagement {
        imports {
            mavenBom("org.springframework.boot:spring-boot-dependencies:2.1.8.RELEASE") {
                bomProperty("kotlin.version", "1.3.61")
            }
        }
    }



}
以及每个模块中的所有
build.gradle.kts

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    id("com.adarshr.test-logger").version("1.7.0") // pretty log printing
    kotlin("jvm")
    kotlin("plugin.spring")
    jacoco
}

group = "no.inmeta.ris.workflow"
version = "0.0.1-SNAPSHOT"
val junit5Version = "5.5.1"

val developmentOnly = configurations.create("developmentOnly")

configurations.runtimeClasspath.get().extendsFrom(developmentOnly)

configurations {
    developmentOnly
    testCompile {
        exclude(group = "junit", module = "junit") // force junit5
        exclude(group = "mocito-core", module = "mockito-core")
    }
}

repositories {
    mavenCentral()
}

dependencies {

    // Spring
    implementation("org.springframework.boot:spring-boot-starter")
    implementation("org.springframework.boot:spring-boot-starter-web")
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")


    // Swagger
    implementation("io.springfox:springfox-swagger2:2.9.2")

    // Testing
    implementation(enforcedPlatform("org.junit:junit-bom:$junit5Version"))
    testImplementation("org.springframework.boot:spring-boot-starter-test:2.1.9.RELEASE")
    testImplementation("org.junit.jupiter:junit-jupiter")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
    testImplementation("org.assertj:assertj-core:3.11.1")

    // Kotlin testing library
    testImplementation("com.ninja-squad:springmockk:1.1.3")
    testImplementation("io.mockk:mockk:1.9.3")

    // Kotlin
    implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.10.0")
}

configure<JacocoPluginExtension> {
    toolVersion = "0.8.4"
}

tasks.withType<JacocoReport> {
    reports {
        xml.isEnabled = true
        csv.isEnabled = false
        xml.destination = file("${buildDir}/jacoco/reports/test.xml")
        html.destination = file("${buildDir}/jacoco/reports/test.html")
    }
}

tasks.withType<Test> {
    useJUnitPlatform()
    testLogging {
        events("passed", "skipped", "failed")
    }
    finalizedBy("jacocoTestReport")
}

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
    jvmTarget = "1.8"
}
val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
    jvmTarget = "1.8"
}
import org.jetbrains.kotlin.gradle.tasks.kotlincomfile
插件{
id(“com.adarshr.test logger”).version(“1.7.0”)//漂亮的日志打印
kotlin(“jvm”)
kotlin(“plugin.spring”)
杰科科
}
group=“no.inmeta.ris.workflow”
version=“0.0.1-快照”
val junit5Version=“5.5.1”
val developmentOnly=配置。创建(“developmentOnly”)
configurations.runtimeClasspath.get().extendsFrom(仅限开发)
配置{
仅限开发
测试编译{
排除(group=“junit”,module=“junit”)//强制junit5
排除(group=“mocito-core”,module=“mokito-core”)
}
}
存储库{
mavenCentral()
}
依赖关系{
//弹簧
实现(“org.springframework.boot:springbootstarter”)
实现(“org.springframework.boot:springbootstarterweb”)
实现(“org.springframework.boot:springbootstarterdatajpa”)
//昂首阔步
实现(“io.springfox:springfox-swagger2:2.9.2”)
//测试
实现(enforcedPlatform(“org.junit:junitbom:$junit5Version”))
测试实现(“org.springframework.boot:springbootstarter测试:2.1.9.RELEASE”)
测试实现(“org.junit.jupiter:junitjupiter”)
testRuntimeOnly(“org.junit.jupiter:junit-jupiter引擎”)
测试实施(“org.assertj:assertj核心:3.11.1”)
//科特林测试库
测试实施(“com.ninja小队:springmock:1.1.3”)
测试实施(“io.mockk:mockk:1.9.3”)
//科特林
实现(“org.jetbrains.kotlin:kotlin-stdlib-jdk8”)
实现(“com.fasterxml.jackson.module:jackson模块kotlin:2.10.0”)
}
配置{
toolVersion=“0.8.4”
}
tasks.withType{
报告{
xml.isEnabled=true
csv.isEnabled=false
xml.destination=文件(“${buildDir}/jacoco/reports/test.xml”)
html.destination=文件(“${buildDir}/jacoco/reports/test.html”)
}
}
tasks.withType{
useJUnitPlatform()
测试记录{
事件(“已通过”、“跳过”、“失败”)
}
定稿人(“JacoTestReport”)
}
val compileKotlin:kotluncompileby tasks
compileKotlin.kotlinOptions{
jvmTarget=“1.8”
}
val compileTestKotlin:KotlUncompile by tasks
compileTestKotlin.kotlinoctions{
jvmTarget=“1.8”
}
在我的配置中是否有任何东西使这个空的生成文件夹出现


谢谢你的帮助

Gradle会在每个项目中自动添加生成目录(这是正常的,每个Gradle项目都有这样的目录)

如果您查看子项目(消息传递、restapi等)的文件夹,您可能会在那里看到类似的构建文件夹。稍后,您可以添加更多gradle插件,将其数据存储在这些目录中


IntelliJ IDEA自动将这些目录标记为已排除,因此IDE不会处理其中的任何文件。如果您使用的是Git,请在.gitignore文件中添加这些目录(只需在其中添加“build”行,它将从VCS中删除所有子项目的所有build文件夹)。如果您看到这些文件夹非常恼火,您可以在IDEA中隐藏排除的文件夹。

您可以运行
/gradlew clean assemble--debug
并找到以下条目:

[org.jetbrains.kotlin.gradle.plugin.KotlinGradleFinishBuildHandler] [KOTLIN] Deleted session-is-alive flag file: build/kotlin/sessions/...
资料来源:

也许,这是罪魁祸首的台词,没有考虑文件夹:

            for (file in sessionFiles) {
                file.delete()
                log.kotlinDebug { DELETED_SESSION_FILE_PREFIX + file.relativeToRoot(rootProject) }
            }

某些任务/插件正在创建目录。它是否以某种方式干扰了发展?不,但如果知道它正在发生什么是好的?我会有一个大项目,所以会很烦人。谢谢:)这是我想要的答案:)都是真的,但没有回答问题中最重要的部分,这个文件夹到底是什么?