Questions tagged [source-sets]

A concept used by the Gradle build system, to divide the source code into parts for which the build process can be configured separately.

66 questions
3
votes
1 answer

gradle sourceSets on mutli-project

My gradle multi-project layout is so: rootProject |-- project1 | |-- project2 | |-- src | |-- main | | |-- groovy | | `-- resources | |-- test | | |-- groovy | | `-- resources | `-- sanity |…
Royg
  • 1,555
  • 1
  • 11
  • 20
3
votes
1 answer

Is it possible to dynamically create source sets?

I am wondering if it is possible to dynamically create a source set with gradle. The directory hierarchy of my current project looks as follows: dbfit-junit module foo bar Each of this module folders (foo and bar) should have its own source…
u6f6o
  • 1,728
  • 2
  • 23
  • 47
2
votes
1 answer

Gradle can't find tests in additional source set

My goal is to set up a source set for integration tests. I created a source set called "intTest". I put a simple test inside: package com.github.frozensync; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import static…
Leroy
  • 2,822
  • 15
  • 25
2
votes
1 answer

Unresolved reference: sourceSets - Gradle Kotlin DSL in another file

In Gradle (Groovy), I used to do this to configure source sets: build.gradle: apply plugin: 'java' apply from: 'gradle/test.gradle' gradle/test.gradle: sourceSets { unitTest { compileClasspath += main.output runtimeClasspath +=…
LeoColman
  • 5,318
  • 5
  • 29
  • 56
2
votes
2 answers

Do I need to add source sets in build.gradle for release/debug java source folders?

I added a new Java source folder release (app/src/release/java) for our release buildType. For this Android Studio automatically added this line to my app/build.gradle: sourceSets { release { java.srcDirs = ['src/release/java', 'src/release/java/']…
jayeshsolanki93
  • 2,041
  • 1
  • 17
  • 37
2
votes
0 answers

android library: multiple source sets

Android library with multiple source sets: apply plugin: 'com.android.library' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { minSdkVersion 12 targetSdkVersion 25 versionCode 1 …
Sunnyday
  • 2,252
  • 1
  • 17
  • 46
2
votes
2 answers

How to build some java files to one jar using gradle java-plugin?

I want to compile some java files to one jar file with gradle. The goal is to add them to a jar and check the dependcies of the tests. Maven should integrate the junit libary. I also want to apply some kind of filter to test only the files with…
user3741086
  • 115
  • 10
2
votes
0 answers

Using Gradle Source Sets to Swap resources directory between dev/prod

I have Java application that uses Gradle. Currently my resources directory contains Typesafe Config and Log4J configuration files. Both of these files would have different settings based on whether my application is built for dev or production. …
vegasje
  • 218
  • 1
  • 7
2
votes
1 answer

Resource merging during gradle builds with different approaches

As we know there are two ways of having separate res directories for each productFlavor or buildType. First Approach is by having separate directories under the src folder e.g. src\flavor1\res, src\flavor2\res etc. Second Approach is specifying the…
2
votes
1 answer

Get SourceSet full path string or path directory

I would like to know if there is a property that returns a SourceSet full path string or file directory, something like ${project.projectDir}/src/${sourceSet.name}. apply plugin: 'java' sourceSets { foo { java { srcDir…
Caio
  • 2,920
  • 6
  • 34
  • 51
2
votes
1 answer

Gradle: includeFlat and sourceSets dependecy for per-platform builds

I'm new to Java world and Gradle. I've made a JSerial lib which will support multiple platforms (Android, Linux and Windows). To be able to choose the platform I'm targetting, I've defined some sourceSets in my JSerial gradle file: sourceSets { …
Thibaut D.
  • 2,101
  • 3
  • 19
  • 29
2
votes
0 answers

Android Gradle method to add sourcesets

Currently I am developing an app with gradle and I have lots of different sourcesets for some different flavors. I am adding sourcesets in my build.gradle the following way: sourceSets { debug { java.srcDirs +=…
jennymo
  • 1,240
  • 1
  • 16
  • 42
1
vote
2 answers

ktor dependency in commonMain of Android Studio multiplatform project unresolved in IDE but code runs

I have an issue with the Android Studio IDE when using the ktor dependency for the commonMain sourceset with kotlin multiplatform. The problem is that the IDE does not recognize this dependency, but the program compiles and runs fine. Furthermore,…
1
vote
1 answer

Gradle SourceSet IntelliJ vs. Eclipse

I'm indicating a problem, when i import a gradle project, which is originally built with Eclipse ,into IntelliJ. In fact the project is a gradle-project, but when I import it into IntelliJ the IDE tells me that it deletes (some) duplicate content…
duffy356
  • 3,468
  • 3
  • 29
  • 43
1
vote
0 answers

How do I set up a gradle Java project with shared inter-dependencies?

I have a Java project consisting of the following parts: a Java library with production code integration tests for that library an demo Java application using that library The integration tests and the demo application share some code, as there…
das-g
  • 8,581
  • 3
  • 33
  • 72