[ERROR] /root/.jenkins/workspace/car/src/main/java/com/zhengxin/tool/code/Code.java:[20,64] diamond operator is not supported in -source 1.5
(use -source 7 or higher to enable diamond operator)
[ERROR] /root/.jenkins/workspace/car/src/main/java/com/zhengxin/controller/WXController.java:[335,58] diamond

由于jenkins默认的jdk是1.5版本,所以编译war包的时候使用的1.5

也许有人问,我没有按装jdk1.5,安装的是1.8--------------------------------1.5是插件自带的

Maven默认用的是JDK1.5去编译

diamond运算符,指的是JDK1.7的一个新特性

List<String> list = new ArrayList<String>(); // 老版本写法
List<String> list = new ArrayList<>(); // JDK1.7及以后的写法
所以Maven默认使用JDK1.5去编译肯定是不认识这个东西的,针对这种问题,本文提供三种解决方案:

Ⅰ :在项目pom.xml中加入下面的配置即可

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Ⅱ:直接在pom.xml中配置Maven的编译插件也是可以的,像下面这样:

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

Ⅲ:另外还有一种最终的解决方案,适用于idea下配置Maven的所有项目:

在配置的maven安装包的setting.xml中的profiles标签中加入以下标签

<profile>    
     <id>jdk-1.8</id>    
     <activation>    
        <activeByDefault>true</activeByDefault>    
        <jdk>1.8</jdk>    
     </activation>    
     <properties>    
        <maven.compiler.source>1.8</maven.compiler.source>    
        <maven.compiler.target>1.8</maven.compiler.target>    
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>    
     </properties>    
</profile>

这样之后就不会出现每次新创建的maven项目默认JDK版本都是1.5版本的了。
---------------------

原文:https://blog.csdn.net/xsm666/article/details/80076253

 

genkins的报错排查的更多相关文章

  1. mysql报错排查总结

    mysql报错: [root@zabbix ~]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through sock ...

  2. idea maven install 卡住,无报错排查。

    今天使用idea打包,执行install,看控制台日志,卡主了(意思是日志不继续在控制台输打印了,卡主了,也看不到错误),也没有报错,然后进行排查. 进入dos命令,进入到项目的根目录,使用 运行 m ...

  3. linux项目,项目报错,排查

    今天在遇到以前部署的项目突然没有数据了,然后就去服务器看了一下,打印日志发现报错了,现在我是一脸懵逼,因为不知道怎么排查 然后同事告诉说先看报错的原因,然后再去找认识的类,我打码的都是一些认识的 然后 ...

  4. [vsftpd] ubuntu14.04 ansible剧本安装vsftpd流程及报错排查

    需求: 在ubuntu14.04机器上搭建ftp服务,ftp账号通过winscp软件登录后,仅可增删改/data/wwwroot目录. 一.安装步骤 1.apt 安装vsftpd apt-get in ...

  5. Jetty启动报错排查org.eclipse.jetty.util.MultiException: Multiple exceptions

    最近自己搭建了一个spring的项目,使用Maven做项目构建,使用JDK8,为了方便启动就使用jetty作为启动容器,但是却无意间步入了一个坑 [WARNING] Failed startup of ...

  6. db2 数据库操作JDBC .addBatch() 方法执行时,报错排查结果

    今天调试db2数据的存储时,jdbc使用addBatch方法时,抛出异常,异常信息如下: [jcc][1091][10404][3.62.56] 数据转换无效:参数实例  对于所请求的转换无效. ER ...

  7. spring boot集成shiro-redis时,分布式根据seesionId获取session报错排查总结

    昨天在集成shiro-redis的时候,使用sessionId在其他微服务获取用户的session时,发生错误:There is no session with id [xxx]. 查遍了所有资料,基 ...

  8. 故障案例 | 主从复制环境中tokudb引擎报错排查过程

    欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源. 0 ...

  9. [svc]线上Iptables重启报错

    线上iptables重启了下发现报错,排查了下 [root@xxxx ~]# /etc/init.d/iptables restart iptables: Setting chains to poli ...

随机推荐

  1. mybatis :xml文件中传入参数和if标签结合使用时要点

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti ...

  2. C#中把任意类型的泛型集合转换成SQLXML数据格式的小例子

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  3. osg反走样

    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; traits-& ...

  4. spring-boot-maven-plugin插件作用

    转自:http://blog.csdn.net/hotdust/article/details/51404828 OM 文件中添加了“org.springframework.boot:spring-b ...

  5. 全面剖析Smarty缓存机制二[清除缓存方法]

    前段时间,写了一篇 Smaryt缓存机制的几种缓存方式 ,详细介绍了三种缓存方式:全局缓存.部分缓存.局部缓存,以及通过is_cache()判断是否存在缓存来进行缓存生成.本来这篇早该完成,由于时间关 ...

  6. vSphere5.5体系结构

    1.vSphere5.5体系结构 vSphere5.5作为云集算操作系统,可以虚拟化服务器.存储.网络在内的整个IT基础架构,将这些架构转化为易于管理的虚拟化!vSphere5.5从逻辑上,可以划分为 ...

  7. 【Android开发精要笔记】Android的Intent机制

    Android的Intent机制 Intent对象的作用和构成 android意图机制最核心的设计思想,就是引入了组件管理服务作为连接组件的管理者. 该服务的作用: 通过组件的配置信息了解系统中每个组 ...

  8. modelsim使用常见问题及解决办法集锦③

    四.You selected Modelsim-Altera as Simulation Software in EDA Tool Settings,however…… You selected Mo ...

  9. Shell脚本中$0、$?、$!、$$、$*、$#、$@

    1. $$Shell本身的PID(ProcessID) 2. $!Shell最后运行的后台Process的PID 3. $?最后运行的命令的结束代码(返回值) 4. $-使用Set命令设定的Flag一 ...

  10. SpringCloud教程 | 第六篇: 分布式配置中心(Spring Cloud Config)(Finchley版本)

    在上一篇文章讲述zuul的时候,已经提到过,使用配置服务来保存各个服务的配置文件.它就是Spring Cloud Config. 一.简介 在分布式系统中,由于服务数量巨多,为了方便服务配置文件统一管 ...