Upgrading to spring 2.3.0.RELEASE made my the emoji chars stop working on my application. After some trial and errors I figured that the problem is on spring-boot-gradle-plugin. Not sure what the plugin is doing wrongly. If I use 2.3.0.RELEASE my emojis does not works If I use 2.2.7.RELEASE my emoji works
Print with both versions: https://imgur.com/a/aYR0ouN 2.2.7.RELEASE-> ❤ 2.3.0.RELEASE-> â¤
buildscript {
ext {
springBootVersion = '2.3.0.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
// classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE")
// classpath("org.springframework.boot:spring-boot-gradle-plugin:2.3.0.RELEASE")
classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.2.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.cloud.tools.appengine-standard'
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
compile 'org.springframework.integration:spring-integration-core' //Used by pubsub
compile 'org.springframework.boot:spring-boot-starter-security'
compile 'org.springframework.boot:spring-boot-starter-validation'
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
testCompile('org.springframework.boot:spring-boot-starter-test')
compile 'org.springframework.cloud:spring-cloud-gcp-starter-data-datastore:1.2.2.RELEASE'
compile 'org.springframework.cloud:spring-cloud-gcp-starter-pubsub:1.2.2.RELEASE'
// compile 'org.springframework.cloud:spring-cloud-gcp-starter-bigquery:1.2.2.RELEASE'
compile 'io.springfox:springfox-swagger2:2.9.2'
compile 'io.springfox:springfox-swagger-ui:2.9.2'
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.80'
compile 'com.google.cloud:google-cloud-datastore:1.102.4'
compile 'com.google.cloud:google-cloud-storage:1.108.0'
compile 'com.google.auth:google-auth-library-oauth2-http:0.20.0'
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
}
wrapper {
// gradleVersion = '6.1.1' //run gradle wrapper after updating
gradleVersion = '6.3' //run gradle wrapper after updating
}
sourceSets {
main {
resources {
exclude 'static/node_modules/'
exclude 'static/src/'
exclude 'static/.*'
exclude 'static/*.js'
exclude 'static/*.json'
exclude 'static/*.txt'
}
}
}
task startBackEnd(dependsOn: [':appengineStop', ':appengineRun']) {
tasks.getByPath(':appengineRun').mustRunAfter ':appengineStop'
}
task buildDeploy(dependsOn: [':buildFrontEnd', ':appengineDeploy']) {
tasks.getByPath(':appengineDeploy').mustRunAfter ':buildFrontEnd'
}
//TODO fix - can't stop properly
task startFrontEnd(type: Exec) {
workingDir "$projectDir/src/main/resources/static"
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', 'npm run dev'
} else {
commandLine 'sh', '-c', 'npm run dev'
}
}
task buildFrontEnd(type: Exec) {
workingDir "$projectDir/src/main/resources/static"
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine 'cmd', '/c', 'npm run build'
} else {
commandLine 'sh', '-c', 'npm run build'
}
}
//TODO move app engine things to another file
ext.getDeployConfig = { ->
def mode = project.hasProperty('mode') ? project.property('mode') : "ivo" //TODO create default environment
def deployConfig = [mode: mode]
if (mode == 'ivo') {
deployConfig.projectId = "click-ivo"
deployConfig.stopPreviousVersion = true
deployConfig.promote = true
deployConfig.version = "1"
}
else if (mode == 'prod') {
deployConfig.projectId = "click-prod"
deployConfig.stopPreviousVersion = true
deployConfig.promote = true
deployConfig.version = "1"
}
else {
throw new GradleException("invalid '-Pmode' argument. Valid: [ivo, prod]")
}
return deployConfig
}
appengine { // App Engine tasks configuration
run {
// jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
jvmFlags = ['-Dspring.profiles.active=dev']
port = 8080
}
deploy {
def config = getDeployConfig()
version = config.version
promote = config.promote
projectId = config.projectId
stopPreviousVersion = config.stopPreviousVersion
}
}
//copies appengine/spring configuration files into explodedWar directory
task copyGaeSpringConfig(type: Copy) {
def envName = getDeployConfig().mode // dev, ivo or prod
def configDir = "$projectDir/gae_config/$envName"
def targetDir = "$buildDir/exploded-$project.name/WEB-INF"
into targetDir
from (configDir) { //appengine-web.xml
include '*.xml'
}
from (configDir) { //application.properties
include '*.properties'
into "/classes"
}
from (configDir + "/config/") { //json config credentials
include '*.json'
into "/classes/config"
}
}
explodeWar.finalizedBy copyGaeSpringConfig
Comment From: bclozel
The code snippet you've provided does not necessarily point to the Spring Boot Gradle plugin. Could you provide a minimal sample project that shows the issue? Ideally, a project created from start.spring.io and using no other Gradle plugin. In your snippet, it's not possible to see where that resource is, how is it processed and packaged by the build, if we can reproduce the problem locally or only in production, the encoding of the resource containing the emoji, etc.
Could you provide a minimal sample application?
Comment From: ivorcosta
While trying to generate the minimum sample I found that the issue was this spring property change name: spring.http.encoding.force got changed to server.servlet.encoding.force
Tks
Comment From: bclozel
Ok I’m closing this issue then. Don’t forget to use the properties migrator this might help you with other changes.
Thanks!