处理jenkins部署war的时候出现如下错误:


[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /diska/jenkins/data/workspace/ci/src/main/java/cn/com/g/cloud/ci/service/que/impl/BaseService.java:[823,48] incompatible types
  required: java.lang.Long
  found:    java.lang.Object

[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE


判断是不是代码中类型问题,开发业务的人说自己maven正常,还是让开发人员尝试修改代码,查看代码:

        public Long incr(final String key) {
                return 10000L;

              return strRedisTemplate.execute(new RedisCallback() {
                      @Override
                      public Long doInRedis(RedisConnection connection) throws DataAccessException {
                              connection.setNX(key.getBytes(), "100000".getBytes());
                              Long rs = connection.incr(key.getBytes());
                              return rs;
                      }
              });
        }



修改为:
        public Long incr(final String key) {
                return 10000L;

              return (Long)strRedisTemplate.execute(new RedisCallback() {
                      @Override
                      public Long doInRedis(RedisConnection connection) throws DataAccessException {
                              connection.setNX(key.getBytes(), "100000".getBytes());
                              Long rs = (Long)connection.incr(key.getBytes());
                              return rs;
                      }
              });
        }


修改后重启构建,果然成功了。

BUILD SUCCEED
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐