Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where to put sourceSets in multiple projects gradle

Tags:

gradle

I have a multiple projects gradle, in the top gradle is

subprojects {

    apply plugin: "java"

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

    repositories {
        mavenCentral()
        maven {
            url "http://repo.springsource.org/milestone"
        }
    }
}

But it complains

> Could not find method sourceSets() for arguments [build_vgdvugn6hqrvg7eo53afh1229$_run_closure1_closure2@19962194] on root project 'testCom'.

So where should I put sourceSets?

like image 874
Daniel Wu Avatar asked Nov 25 '14 23:11

Daniel Wu


People also ask

How do you add dependency from one project to another in Gradle?

Dependency types To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.

What is sourceSets in Gradle?

Gradle has the concept of source sets for where your code and test sources live. Some Gradle plugins come with default source sets, for example the Java plugin has a "main" source set where the default location is src/main/java .

In which file do we mention project dependencies?

If you declare a module dependency, Gradle looks for a module metadata file ( . module , . pom or ivy. xml ) in the repositories.


1 Answers

The error message is a bit misleading, but before you can configure sourceSets.main.scala, you'll have to apply the scala plugin.

like image 71
Peter Niederwieser Avatar answered Oct 11 '22 12:10

Peter Niederwieser