Monday, 15 February 2010

java - How would one configure a Gradle project in which a subproject depends on the main project? -



java - How would one configure a Gradle project in which a subproject depends on the main project? -

i have mini-application in source code trying move separate subproject. however, mini-application depends on main project. how 1 set build.gradle file reflect this?

here directory structure:

/ src/ main/java/<main project source> build.gradle settings.gradle subproject/ src/ main/java/<subproject source> build.gradle

i thinking 1 in build.gradle file subproject:

build.dependson ":build"

but doesn't seem work.

you need set compile dependencies correctly work.

the statement build.dependson ":build" set task dependencies (i.e. :subproject:build executed after main project ":build"). not necessary, main project build executed before subproject builds anyway. not set compile dependencies (i.e. classes/libraries include).

instead (or in addition) add together compile dependency main project in subproject/build.gradle file:

dependencies { compile project(':') }

java gradle project-management project-structure multi-project

No comments:

Post a Comment