Java项目Gradle版本2.14.1升级至5.5.1记录

84 篇文章 0 订阅
19 篇文章 0 订阅
  1. Gradle5.5.1版本set()方法不可用
   注意构建时候gradle的提示信息:
   The set() method has been deprecated and is scheduled to be removed in Gradle 3.0. Please use the setProperty() or ext.set() method instead.
   The plugin id 'spring-boot' is deprecated. Please use 'org.springframework.boot' instead.
def environment = hasProperty('env') ? env : 'dev'
 	project.set('environment', environment)

需要修改为:

ext.set('environment', hasProperty('env') ? env : 'dev')
  1. Gradle构建项目报错: Could not find method leftShift() for arguments
task hello << {  
		println 'Hello world!'  
}

解决方法:去掉build.gradle文本中的<<

task hello {  
		println 'Hello world!'  
}
  1. springboot+jsp页面不能访问
#修改本地启动的方式为:
mvn spring-boot:run   
#或
gradlew bootRun
#在application.properties中增加配置:
spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp
  1. Gradle4.6之后的版本更新内容:

向Java项目添加注释处理器变得更加容易。只需将它们添加到annotationProcessor配置中:

dependencies {
    annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
    implementation 'com.google.dagger:dagger:2.8'
}

将lombok依赖项类型从更改compileannotationProcessor,因此build.gradle文件中的依赖项部分应如下所示:

dependencies {
  compile('org.projectlombok:lombok:1.16.20')
  annotationProcessor 'org.projectlombok:lombok:1.16.20'
    // compile 'org.projectlombok:lombok:1.16.20' <-- this no longer works!
    // other dependencies...
}
  1. 升级spring-boot-gradle-plugin的版本,从1.2.2升级为1.5.9
  buildscript {
  	dependencies {
  		classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE")
  	}
  }
  1. springboot版本从1.2.2升级到1.5.9

  2. gradle中的mainClassName不可用

   	异常:No such property: mainClassName for class
   	解决方案:
   	增加:
   	apply plugin: 'application' 
  1. FilterRegistrationBean类从1.2.2版本到1.5.9版本路径修改
     import org.springframework.boot.context.embedded.FilterRegistrationBean;
     改为:
     import org.springframework.boot.web.servlet.FilterRegistrationBean;
  1. @ConfigurationProperties注解中locations 参数不可用
   @ConfigurationProperties(locations = "classpath:/config/application.properties", prefix = "test")
   修改为:
   @ConfigurationProperties(prefix = "test")
   @PropertySource("classpath:/config/application.properties")
  1. dao-datasource.xml中writeDataSource bean中增加primary="true"属性
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值