Is 'compileJava.options.encoding' ignored for multiproject?

‘compileJava.options.encoding’ seems to be ignored for multiproject.

I got an error message of “java.nio.charset.UnsupportedCharsetException: aaaaaaaaaaaaaa” when I set compileJava.options.encoding = ‘aaaaaaaaaaaaaa’ for a single project. But no any errors occur for a multiproject on both of subprojects in parent project or property in subproject.

Any helps? Thanks!

My environment:
Gradle 2.4 + JVM 1.8.0_45 + OS Windows 8.1 6.3 amd64 + cygwin

how did you configure this in your multiproject build? you have to set it for each project in your multiproject build. it is not enough to set it just on the root level.

My build.gradle for my parent projecct:

buildscript {

}

allprojects {

}

subprojects {
apply plugin: 'java’
apply plugin: 'eclipse’
apply plugin: ‘maven’

compileJava.options.encoding = 'aaaaaaaaa'
compileTestJava.options.encoding = 'UTF-8'
...

}

Build.gradle for a sub project:

description = “”“Subproject”""

dependencies {

}

compileJava.options.encoding = ‘aaaaaaaaa’

your build will only fail when executing the first compileJava task in your multiproject build, not during configuration phase

I tried to set compileJava.options.encoding with aaaaa only in sub project. But the subproject compileJava task does not fail. It looks like the default encoding is used to compile java classes.

weired. I am not able to reproduce this. The task will only not fail from my experience if you havn’t provided any sources as the task is then skipped and marked as up-to-date. Can you provide a small reproducible example?

I found that Gradle AspectJ plugin causes ‘compileJava.options.encoding’ ignored for my subproject.

Here is my original root project build.gradle:

buildscript {
repositories {
jcenter()
maven { url “https://maven.eveoh.nl/content/repositories/releases” }
}

dependencies { 
    classpath "nl.eveoh:gradle-aspectj:1.5"
    classpath 'com.github.lkishalmi.gradle:gradle-bom-plugin:0.3'
}

}

description = “”“RootProject”""

project.ext {
aspectjVersion = ‘1.8.5’
}

allprojects {
group = 'com.mycompany’
version = ‘1.0.0’
}

subprojects {
apply plugin: 'java’
apply plugin: 'eclipse’
apply plugin: 'maven’
apply plugin: ‘aspectj’

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
     maven { url "http://repo.maven.apache.org/maven2" }
     jcenter()
}

compileJava.options.encoding = 'aaaaaaa'
compileTestJava.options.encoding = 'UTF-8'

}

As long as I removed the Gradle AspectJ plugin, the invalid compileJava.options.encoding will fail my subproject’s compileJava.

How to make Gradle AspectJ plugin works together with compileJava.options.encoding for multiproject?