maven對 "xxx是Sun 的專用 API,可能會在未來版本中刪除"編譯出錯的處理
阿新 • • 發佈:2019-01-23
maven在編譯含有sun私有API的java程式碼的時候,會出錯並報告BUILD FAILURE。
報錯如下:
警告:com.sun.rowset.CachedRowSetImpl 是 Sun 的專用 API,可能會在未來版本中刪除
問題在於plexus-compiler-javac這個模組中,當遇到中文警告資訊時均判斷成CompileError,直接導致maven-compile-plugin丟擲編譯錯誤。
解決方案:使用maven release的maven-compiler-plugin 2.3.2或者以上。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> <encoding>UTF-8</encoding> </configuration> </plugin>