IntelliJ中刷新gradle导致源文件夹结构发生更改 [英] Refreshing gradle in IntelliJ causes source folder structure to change

查看:152
本文介绍了IntelliJ中刷新gradle导致源文件夹结构发生更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在IntelliJ IDEA中运行刷新gradle时,我的主文件夹被设置为源根,但是未标记"java"(它是我的实际源根).

When I run refresh gradle in IntelliJ IDEA, my main folder is set to be the source root, but "java", which is my actual source root, is unmarked.

每次执行gradle refresh之后,我都必须手动更改此内容.

I have to change this manually every time after I do gradle refresh.

您知道相关的gradle设置是什么吗?

Do you know what the relevant gradle setting is?

可以在通用的gradle文件中吗?

Can it be in a common gradle file?

是否应该将main文件夹更改为源根目录?

Should I change the main folder to be the source root?

我怎么知道我可能继承的普通gradle? 如何在我的本地build.gradle中覆盖它?

How can I know where is the common gradle I might inherit from? How can I override this in my local build.gradle?

我的build.gradle:

My build.gradle:

apply plugin: 'java'
apply plugin: 'application'

sourceCompatibility = 1.8
version = '1.0'

repositories {
    mavenCentral()
}

dependencies {
//
//    configurations.all*.exclude(group: 'com.sun.jersey', module: 'jersey-bundle')
//    configurations.all*.exclude(group: 'com.fasterxml.jackson.core', module:'jackson-databind')


    compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'

    compile 'com.google.inject:guice:4.0-beta5'
    compile 'com.sun.jersey:jersey-core:1.18.3'
    compile 'com.sun.jersey:jersey-client:1.18.3'
    compile 'com.sun.jersey:jersey-json:1.18.3'
    compile 'com.sun.jersey.contribs:jersey-apache-client:1.18.3'
    compile group: 'junit', name: 'junit', version: '4.11'
    compile 'com.vividsolutions:jts:1.13'
    compile 'net.sf.opencsv:opencsv:2.3'
    compile 'com.googlecode.json-simple:json-simple:1.1'
    compile 'com.google.guava:guava:18.0'

    //testCompile group: 'junit', name: 'junit', version: '4.11'
}


sourceSets {
    main {
        java {
            srcDirs = ['src/main']
        }
    }

    test {
        java {
            srcDirs = ['src/main']
        }
    }
}


test {
    testLogging {
// Show that tests are run in the command-line output
        events 'started', 'passed'
    }
}


task run_BaselineGenerator(type: JavaExec) {
    classpath sourceSets.main.runtimeClasspath
    main = "com.waze.routing.automation.runners.BaselineGenerator"
}

推荐答案

您的sourceSet对我来说似乎不正确.我会尝试:

Your sourceSets look incorrect to me. I would try:

sourceSets {
    main {
        java {
            srcDirs = ['src/main/java']
        }
    }

    test {
        java {
            srcDirs = ['src/test/java']
        }
    }
}

这篇关于IntelliJ中刷新gradle导致源文件夹结构发生更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆