Add another java source directory to gradle script

前端 未结 4 838
温柔的废话
温柔的废话 2020-12-17 07:59

I hava an example java project package

package com.example.testing;

with such file tree

app
|
  src->com->example->testing->Main         


        
4条回答
  •  一个人的身影
    2020-12-17 08:19

    I have a slightly different approach with a Gradle 4.6:

    sourceSets {
        main {
            java {
                srcDir 'src/main/java'
                srcDir 'build/swagger-code-dummy/src/main/java'
            }
        }
    }
    

    as you can see, I had to specify the directories with the "/main/java" subdirectories as well, otherwise gradle/intellij was not setting the right path.

    Maybe this helps someone else too :)

提交回复
热议问题