Gradle Goodness: Set Java Compiler Encoding--转载

原文地址: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
时间: 2024-11-07 10:55:33

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

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.encoding property. For example we could add the following line to our Gradle build file to change the encoding for the compileJava task: view sourceprint? 0

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 want to run Java code from an external dependency we must first pull in the dependency with the Java application code. The best way to do this is to

解决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 version of the installed java project facet错误的解决 因工作的关系,Eclipse开发的Java项目拷来拷去,有时候会报一个很奇怪的错误.明明源码一模一样,为什么项目复制到另一台机器上,就会报"java compiler level does not match t

java debug jdk(转载)

Debug info unavailable 解决之道 从事Java的小伙伴们估计都有断点代码的习惯,可以很方便的查看运行期代码中一些变量的值. 但是JDK中有些类你会发现是无法断点的,即使你在IDE中关联了src.zip依然不好使.这是为什么呢? 答案: Java classes which are part of the JDK are compiled without debug info for the size and performance reasons. If you want

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. One of the ways to alter the build configuration is with initialization or init scripts. These are like other Gradle scripts but are executed before t

Gradle工程错误:Gradle sync failed: Java home is different

Gradle sync failed: Java home is different (1)错误描述 Gradle sync failed: The newly created daemon process has a different context than expected. It won't be possible to reconnect to this daemon. Context mismatch: Java home is different. Wanted: Default

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.点击工具栏上的"Window" ->"Preferences"->"Java"->"Compiler"->选择高版本jdk 2.右键项目->"Properties"->"J

maven -- 问题解决(三)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 解决方法如下: properties->Java Compiler,修改JDK版本,然后Apply

Error:java: Compilation failed: internal java compiler error

1.新建maven项目时,jdk用的是1.8,但是编译代码提示失败 IDE要设置几个地方 1.点击项目 选择 project structure 2.设置project的 project sdk 和 project language level 3.设置modules的jdk版本,选择8 4.选择setting,设置java compiler 选择jdk1.8