前言:
假期重装了系统,从win10回到了8.1,环境配置等等都要重头来。这里总结我们团队将无构建工具辅助的java web项目转为gradle+cargo管理时我个人遇到的问题。
部分可能比较奇葩和与基础环境变量有关
具体前提大坑:https://perqin.github.io/2017/02/27/migrate-java-web-application-to-gradle-build-system/
展示一下我的环境:
正题:
直接上问题内容以及解决方式。
1.使用gradle assemble进行到complieJava报错。
Execution failed for task ':compileJava'
错误:出现非法字符
报错乱码
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
2.运行cargo的时候总是超时。
Caused by: org.codehaus.cargo.container.ContainerException: Deployable [http://127.0.0.1:8080/cargocpc/index.html] failed to finish deploying within the timeout period [120000].
The Deployable state is thus unknown.
为了避免因为部分文件超时而造成问题- -
在build.gradle文件中的cargo部分加入timeout的时间设定。
cargo {
containerId = 'tomcat7x'
// port = 9090
deployable {
context = '/'
}
local {
jvmArgs = '-XX:PermSize=256M -XX:MaxPermSize=512m -Xms256m -Xmx1024m'
homeDir = file(System.env.TOMCAT_HOME)
outputFile = file('build/output-' + getDate() + '.txt')
logFile = file('build/log-' + getDate() + '.txt')
logLevel = 'high'
timeout = 60000000 //时间是我随便设定,也有说设定为0的说法
containerProperties {
property 'cargo.tomcat.ajp.port', 9099
}
}
}
cargoRunLocal.dependsOn assemble
解决问题!
3.之前成功运行之后, 关机,过了几天,又发现了新问题。- -
[15:12:28.867][info][talledLocalContainer] Tomcat 7.x starting...
[15:12:28.868][warn][talledLocalContainer] org.codehaus.cargo.container.ContainerException: Failed to create a Tomcat 7.x standalone configuration
在命令行加入 --stacktrace查看主要问题
我是删除C:\USERS\APPDATA\TEMP\CARGO\CONF下的webapp完成