jenkins bulid时报错,是因为com.sun.image.codec.jpeg是sun公司私有包,oracle在1.7后不再支持
修改下代码即可解决问题
原code:
BufferedImage tag = new BufferedImage((int) newWidth, (int) newHeight, BufferedImage.TYPE_INT_RGB);
FileOutputStream out = new FileOutputStream(dir+filename);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(tag);
现code:
String formatName = filename.substring(filename.lastIndexOf(".") + 1);
ImageIO.write(tag, formatName, new File(dir+ filename));
时间: 2024-10-12 19:38:30