jenkins报错strings in switch are not supported in -source 1.5

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

清理下“工作空间”


重新构建,成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值