原文地址:http://java.dzone.com/articles/gradle-goodness-set-java

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:

apply plugin: 'java'
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:

apply plugin: 'java'

tasks.withType(JavaCompile) 
{ options.encoding = 'UTF-8' }

gradle->eclipse
编辑build.gradle文件,在文件最前面增加一行:
apply plugin: 'eclipse'

gradle eclipse

忽略测试使用命令:

gradle build -x test

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

  1. Gradle Goodness: Set Java Compiler Encoding

    If we want to set an explicit encoding for the Java compiler in Gradle we can use the options.encodi ...

  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 the version of the installed java project facet【转载】

    原博文地址http://blog.csdn.net/chszs/article/details/8125828 Java compiler level does not match the versi ...

  4. java debug jdk(转载)

    Debug info unavailable 解决之道 从事Java的小伙伴们估计都有断点代码的习惯,可以很方便的查看运行期代码中一些变量的值. 但是JDK中有些类你会发现是无法断点的,即使你在IDE ...

  5. Eclipse------导入项目后出现Java compiler level does not match the version of the installed Java project facet

    报错信息:Java compiler level does not match the version of the installed Java project facet 解决方法: 1.点击工具 ...

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

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

  7. 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. ...

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

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

  9. 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 ...

随机推荐

  1. 如何将自定义RPM包加入YUM

    1 前言 在很多时候进行编译了自己的RPM包,在搭建YUM的时候,希望将自定义的RPM加入到YUM源中,从而出现了下列方法. 2. 将RPM包加入YUM源 2.1 查看目前repodata位置 YUM ...

  2. 使用python的logging模块

    一.从一个使用场景开始 开发一个日志系统, 既要把日志输出到控制台, 还要写入日志文件 import logging # 创建一个logger logger = logging.getLogger(' ...

  3. JavaScript中的*top、*left、*width、*Height详解

    来源:http://www.ido321.com/911.html html代码 1: <body> 2: <div class="father" id=&quo ...

  4. Apache Hadoop 镜像地址

    HTTP http://apache.fayea.com/ http://apache.opencas.org/ http://mirror.bit.edu.cn/apache/ http://mir ...

  5. Context Menu on DataGrid

    应该设置  fitColumns: true 合并表头显示有问题 代码见示例

  6. homework-05

    经过这几天的深思熟虑我和小明同学将这次作业基本的完整了,可能界面略丑陋,但是基本功能均已实现.我们的服务器端采用python编写,因为服务器端是这次作业的难点,而python中有一个叫做web.py的 ...

  7. Java设计模式系列之工厂模式

    工厂模式将大量有共同接口的类实例化,工厂模式可以实现动态决定实例化哪一个类的对象,工厂模式在<Java与模式>中分为三类:1)简单工厂模式(Simple Factory):添加某一种类型的 ...

  8. CodeForces 682A Alyona and Numbers (水题)

    Alyona and Numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/A Description After fi ...

  9. 蓝桥杯 入门训练 Fibonacci数列

      入门训练 Fibonacci数列   时间限制:1.0s   内存限制:256.0MB        问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1. ...

  10. Codeforces Round #116 (Div. 2, ACM-ICPC Rules) E. Cubes (尺取)

    题目链接:http://codeforces.com/problemset/problem/180/E 给你n个数,每个数代表一种颜色,给你1到m的m种颜色.最多可以删k个数,问你最长连续相同颜色的序 ...