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
0
votes
0 answers

Gradle: Adding sourceSets to eclipse classpath

I have a few sourceSets, s1 and s2 and I expect more to be added in the future to my gradle project. Now, when I need eclipse to consider these source as source folders, I want to use a loop through the sourceSets rather than add indidvdual items.…
0
votes
1 answer

Kotlin DSL adding Kotlin SourceSets doesn't affect

I am adding Kotlin SourceSets to my project but I am unable to see Kotlin source in the Project layout. What I have in build.gradle.kts sourceSets { getByName("main").java.srcDirs("src/main/kotlin") } What I see in the project path And…
nuhkoca
  • 1,114
  • 3
  • 11
  • 32
0
votes
0 answers

How to add gradle task to compile additional SourceSet

I have a KotlinJS-project using plugins { kotlin("js") } Kotlin-compiler-plugin that generates new .kt-files (right now in folder $buildDir/src/main/generated) when task build is executed. Unfortunately I have to call build a second time to…
jens
  • 443
  • 2
  • 12
0
votes
1 answer

Gradle + Spring Boot - how can I read resources in "itest" sourceSet in a test in "test" sourceSet

I have sourceSet itest, test and main at the save level. In a test in test sourceSet, I want to read a text file in itest/resources. Is that possible?
WesternGun
  • 7,222
  • 56
  • 97
0
votes
1 answer

SourceDirectorySet of a single file

I'm trying to create a custom gradle source set consisting of a set of files (no necessarily located in the same directory). Each file may be located in a directory that contains other files that are not supposed to be part of the source directory…
czerny
  • 11,433
  • 12
  • 57
  • 80
0
votes
1 answer

Idea Gradle integration add classes as a test source tree, but don't include in test sourceSet

I would like to mark the classes of my systest sourceSet as unit test classes. I tried to mark them with the following code: sourceSets { main { groovy { srcDirs = [ 'src/main/masks' } resources { srcDirs +=…
Stefan Sprenger
  • 972
  • 18
  • 41
0
votes
2 answers

Gradle set outputDir of java classes

Here I have a sourceset of java file in 'src/main/java', I want to post the classFiles generated to the outputDir mentioned, but I GET AN ERROR. Could not find method outputDir() for arguments [src/main] on root project Here is the snippet from…
Srinivas Jayaram
  • 317
  • 4
  • 15
0
votes
1 answer

after upgrade to gradle 4.x - unable to resolve warning for JEE project

I'm unable to get rid of a warning in a gradle 4.2 build: Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is…
wemu
  • 7,236
  • 3
  • 30
  • 51
0
votes
1 answer

gradle: why there is no jar task for all sourceSets

Added sourceSet web, but there is no corresponding tasks for it: apply plugin: 'java' sourceSets { web } Build tasks ----------- assemble - Assembles the outputs of this project. build - Assembles and tests this project. buildDependents -…
eastwater
  • 781
  • 1
  • 10
  • 28
0
votes
1 answer

Omit class file from jar in gradle

I'm writing a gradle plugin that modifies class files. I want the task to run on all the generated class files and replace them. Here's what I have so far: public class InstrumenterTask extends DefaultTask { private File outputDir; private…
WorldSEnder
  • 4,399
  • 1
  • 24
  • 53
0
votes
0 answers

Gradle leaks sourceSet from java rootProject to non-java subProjects

Imagine you have simple multi-project build with one root project and one subproject: root |--sub | `----build.gradle |----build.gradle `----settings.gradle settings.gradle: include ':sub' root/build.gradle: apply plugin:…
Fanick
  • 610
  • 7
  • 23
0
votes
1 answer

Gradle Error : Cannot infer Groovy class path : custom sourcesets for integration tests

Getting this error when running custom task "integTest", tried on both Gradle 2.4 and 3.0. Still fairly new to gradle, could be something obvious. FAILURE: Build failed with an exception. What went wrong: Cannot infer Groovy class path because no…
solvingJ
  • 1,130
  • 14
  • 27
0
votes
1 answer

Whats wrong with this that causes my integration tests to be marked as source rather than test source?

This works fine from the command line but IntelliJ displays the integrationTest sources as if they were source and not test source. Gradle code: sourceSets { integrationTest { java { compileClasspath += main.output +…
user447607
  • 4,109
  • 7
  • 29
  • 53
0
votes
2 answers

Filter class files from compiled sourcesets to be added in a JAR in Gradle/Groovy

I'm trying to include the compiled .class files from Project1 into the jar for Project2 since my project structure requires it to be done. For that, in the build.gradle for Project2, I write : jar { from…
0
votes
1 answer

Is there a way to have different "androidTest.java.srcDirs" for each buildType in gradle?

I Have a requirement to execute android test cases for each build type. So "androidTest.java.srcDirs" will have different values for each build type. For buildType 1 : androidTest.java.srcDirs = ['tests/intrumentation1'] For buildType 2…