I am building a multiple module project and started on working the first module.
The build.gradle file from the parent module contains the following
allprojects {
apply plugin: ‘maven’
group = ‘com.multi.modules’
version = ‘1.0.0-SNAPSHOT’ }
subprojects {
apply plugin: ‘java’
sourceCompatibility = 1.8
targetCompatibility = 1.8
/* add a provided scope for dependencies */
configurations {
provided
compile.extendsFrom provided
}
repositories {
mavenLocal()
}
}
The settings.gradle looks like
rootProject.name = ‘TestingMultiModule’ include ‘:processor’
The child build.gradle at processor directory contains
apply plugin:‘scala’
description = ‘The Processor’
dependencies {
compile group: ‘com.typesafe’, name:‘config’, version: ‘1.2.1’
testCompile group: ‘org.hamcrest’, name: ‘hamcrest-all’, version:‘1.3’
testCompile group: ‘org.mockito’, name: ‘mockito-core’, version:‘1.9.5’
testCompile group: ‘com.jayway.awaitility’, name: ‘awaitility’, version:‘1.6.0’
testCompile group: ‘com.jayway.awaitility’, name: ‘awaitility-java8’, version:‘1.6.0’
testCompile group: ‘junit’, name: ‘junit’, version:‘4.11’ }
I have some basic java and scala code in the processor module. After invoke ./gradlew clean jar
jar -tf processor/build/libs/processor-1.0.0-SNAPSHOT.jar META-INF/ META-INF/MANIFEST.MF
I am not sure why non of my source file is compiling into a class file.
I tried to remove the scala plugin and the java code is not generated when I ran ./gradlew compileJava.
A little lost on what is going on here.
UPDATE: when ran in debug mode I noticed Skipping task ‘:processor:compileJava’ as it has no source files. As it turn out, it is my fault. I didn’t place the file structure correctly. The fix is fix my file structure, ie /src/main/java.