jenkins部署应用时报错:
[ERROR]
/diskc/jenkins/data/workspace/civp_ms/civp_interface/src/main/java/cn/com/geo/cloud/civp/service/query/impl/TelecomGroup_AgeL
abel_ServiceImpl.java:[118,24] strings in switch are not supported in -source 1.5
(use -source 7 or higher to enable strings in switch)
[ERROR]
/diskc/jenkins/data/workspace/civp_ms/civp_interface/src/main/java/cn/com/geo/cloud/civp/service/query/impl/TelecomGroup_Bala
nceLabelOfMdn_ServiceImpl.java:[126,24] strings in switch are not supported in -source 1.5
(use -source 7 or higher to enable strings in switch)
分析:
难到jenkins使用jdk1.5版本的进行打包编译?
查看下jenkins的 “系统设置” JDK项已经使用的是JDK1.7的
网上搜索了下,需要在jenkins配置文件中修改
修改默认jdk版本
cd /root/.jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven/conf
先备份cp setting.xml setting.xml.bak
vi setting.xml文件中
<!--
Here is another profile上方增加
<profile>
<id>jdk-1.7</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.7</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
</properties>
</profile>
设置为1.7版本的JDK
清理下“工作空间”
重新构建,成功