使用maven install命令打包时,错误如下:
[ERROR] Unable to locate the Javac Compiler in:
D:\Program Files\Java\jre\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.557 s
[INFO] Finished at: 2018-11-29T14:36:36+08:00
[INFO] Final Memory: 14M/204M
查阅可很多资料,发现:
是因为没有 D:\Program Files\Java\jre…\lib\tools.jar,这个tools.jar,
解决方法:
在eclipse中点击Windows—>Preference—>java---->Insralled JREs
在已添加的jres里点击Edit—>然后再新打开的页面点击Add External JARs…添加tools.jar包即可。
等eclipse更新完之后重启eclipse,然后再使用maven打包就可以了。
打包的方法:现在pom.xml文件—》右击 run as 或者debug as —>maven install 就可以了
最后,在该项目的target下找到war包和jar包