您好我只是下载maven二进制文件并在设置了所有环境变量之后,我正在运行mvn -version
cmd并获得此异常.
Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.codehaus.plexus.util.Os.OS_NAME from class org.apache.maven.cli.CLIReportingUtils at org.apache.maven.cli.CLIReportingUtils.showVersion(CLIReportingUtils.
java:71)org.apache.maven.cli.MavenCli.cli(MavenCli.java:423)org.apache.maven.cli.MavenCli.doMain(MavenCli.java:277)org.apache.maven.cli .MavenCli.main(MavenCli.java:199)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl. java:43)at java.lang.reflect.Method.invoke(Method.java:497)org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:289)at org.codehaus.plexus. classworlds.launcher.Launcher.launch(Launcher.jav a:229)位于org.codehaus.plexus.classworlds.launcher.Launcher的org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:415). main(Launcher.java:356)
在这里下载Maven .
解压缩,例如: C:\tools\
按Windows+ R,键入systempropertiesadvanced
,按Enter
设置环境:MAVEN_HOME
=C:\tools
添加到PATH
环境变量:;%MAVEN_HOME%\bin
关闭所有
调用cmd
,运行命令:
mvn -v