If we want to set an explicit encoding for the Java compiler in Gradle we can use the options.encoding property. For example we could add the following line to our Gradle build file to change the encoding for the compileJava task:

0.apply plugin: 'java'
1. 
2.compileJava.options.encoding = 'UTF-8'

To set the encoding property on all compile tasks in our project we can use the withType() method on the TaskContainer to find all tasks of type Compile. Then we can set the encoding in the configuration closure:

0.apply plugin: 'java'
1. 
2.tasks.withType(Compile) {
3.options.encoding = 'UTF-8'
4.}

Gradle Goodness: Set Java Compiler Encoding的更多相关文章

  1. Gradle Goodness: Set Java Compiler Encoding--转载

    原文地址:http://java.dzone.com/articles/gradle-goodness-set-java If we want to set an explicit encoding ...

  2. Gradle Goodness: Running Java Applications from External Dependency

    With Gradle we can execute Java applications using the JavaExec task or the javaexec() method. If we ...

  3. Java compiler level does not match解决方法(转)

    本文转自:https://www.cnblogs.com/lauer0246/p/5740572.html#undefined 从别的地方导入一个项目的时候,经常会遇到eclipse/Myeclips ...

  4. Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects

    Gradle Goodness: Init Script for Adding Extra Plugins to Existing Projects Gradle is very flexible. ...

  5. idea中解决Error:java: Compilation failed: internal java compiler error的问题

    项目中,使用gradle做项目构建,当我们想更改JDK的版本时,报以下错误: Information:Using javac 1.8.0_111 to compile java sourcesInfo ...

  6. Android Studio运行报错,Cannot find System Java Compiler. Ensure that you have installed a JDK......

    详细报错信息如下 Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Cannot find System J ...

  7. Java异常 | Error:java: Compilation failed: internal java compiler error

    背景 今天网上下载了一个项目,编辑运行报如下异常: Error:java: Compilation failed: internal java compiler error 经过往经验,读项目的编译环 ...

  8. Java compiler level does not match解决方法

    从别的地方导入一个项目的时候,经常会遇到eclipse/Myeclipse报Description  Resource Path Location Type Java compiler level d ...

  9. idea报错:error java compilation failed internal java compiler error

    idea下面报如下问题 error java compilation failed internal java compiler error 解决办法:Setting->Compiler-> ...

随机推荐

  1. 8、springboot之定时任务

    @Configuration @EnableScheduling public class SchedulingConfig { @Scheduled(cron = "0/5 * * * * ...

  2. Django之路由、模板和模型系统 (转载)

    一.路由系统 浏览器会自动给url后加一个“/” django会自动给路由的正则表达式前面加一个“/” django会给任何不带“/”结尾的url语句添加“/”(可设置) 短路路由规则:匹配到第一条就 ...

  3. shell脚本报错 value too great for base

    此错误是shell脚本在计算以0开头的数字时,默认以8进制进行计算,导致在计算08时超过了8进制的范围,报此错误. shell脚本代码如下: #!/bin/bash a= ..} do a=$[$a+ ...

  4. Java CAS总结

    文章目录 1. CPU指令对CAS的支持(CPU的cas指令是原子的) 或许我们可能会有这样的疑问,假设存在多个线程执行CAS操作并且CAS的步骤很多,有没有可能在判断V和E相同后,正要赋值时,切换了 ...

  5. lintcode 题目记录3

    Expression Expand  Word Break II Partition Equal Subset Sum  Expression Expand  字符串展开问题,按照[]前的数字展开字符 ...

  6. 三种角度解释href/src/link/import区别

    网上查到的几种不同但比较容易理解的解释 解释一: href是Hypertext Reference的缩写,表示超文本引用.用来建立当前元素和文档之间的链接.常用的有:link.a.例如: <li ...

  7. struts1 & jquery form 文件异步上传

    1.概述 还在用struts1?是的,在地球的没写地方,落后的生产方式还在运转(老项目). 从 继承org.apache.struts.action.Action, 继承org.apache.stru ...

  8. Python-并发编程(线程)

    之前我们说了并发编程中的进程问题,几天我们来聊聊并发编程中的线程问题. 一.背景知识 1.进程 之前我们已经了解了操作系统中进程的概念,程序并不能单独运行,只有将程序装载到内存中,系统为它分配资源才能 ...

  9. 小白学习css记录

    一.复习 什么是CSS? 层叠样式表 -层叠样式只会被覆盖而不会被替代 CSS的使用方式 style属性---> <h1 style="css属性"></h ...

  10. web前端开发需要具备的技能

    web前端开发需要具备以下7种技能: 1.页面标记(HTML) HTML页面固定,标签不多,相对来说学起来比较容易.编写HTML代码需遵循HTML代码规范(http://www.cnblogs.com ...