[英]Error trying to run maven on windows
我試圖在Windows 7上安裝Maven。我嘗試了3.3.3和3.3.1版,但結果相同。 我嘗試使用JAVA_HOME和path變量更改jdk,但得到的結果相同。
我是新手,所以請原諒我的無知。
我注釋掉了mvn.cmd腳本中的回顯,以嘗試進行調試。
啟動maven的Java調用僅顯示Java幫助消息,就好像命令無效一樣。 我究竟做錯了什么?
H:\>"C:\bin\jdk1.7.0_60\bin\java.exe" -classpath "c:\bin\apache-maven-3.3.1\bin\..\boot\plexus-classworlds-2.5.2.jar" "-Dclassworlds.conf=c:\bin\apache-maven-3.3.1\bin\..\bin\m2.conf" "-Dmaven.home=c:\bin\apache-maven-3.3.1\bin\.." "-Dmaven.multiModuleProjectDirectory=H:\" org.codehaus.plexus.classworlds.launcher.Launcher
H:\>mvn
H:\>if "H:\" == "" (set "HOME=H:\" )
H:\>if not "" == "" goto skipRcPre
H:\>if exist "H:\\mavenrc_pre.bat" call "H:\\mavenrc_pre.bat"
H:\>if exist "H:\\mavenrc_pre.cmd" call "H:\\mavenrc_pre.cmd"
H:\>set ERROR_CODE=0
H:\>if not "C:\bin\jdk1.7.0_60" == "" goto OkJHome
H:\>if exist "C:\bin\jdk1.7.0_60\bin\java.exe" goto chkMHome
H:\>if not "" == "" goto valMHome
H:\>SET "M2_HOME=c:\bin\apache-maven-3.3.1\bin\.."
H:\>if not "c:\bin\apache-maven-3.3.1\bin\.." == "" goto valMHome
H:\>if not "_." == "_\" goto checkMCmd
H:\>if exist "c:\bin\apache-maven-3.3.1\bin\..\bin\mvn.cmd" goto init
H:\>set MAVEN_CMD_LINE_ARGS=
H:\>set MAVEN_PROJECTBASEDIR=
H:\>IF NOT "" == "" goto endDetectBaseDir
H:\>set EXEC_DIR=H:\
H:\>set WDIR=H:\
H:\>IF EXIST "H:\"\.mvn goto baseDirFound
H:\>cd ..
H:\>IF "H:\" == "H:\" goto baseDirNotFound
H:\>set MAVEN_PROJECTBASEDIR=H:\
H:\>cd "H:\"
H:\>IF NOT EXIST "H:\\.mvn\jvm.config" goto endReadAdditionalConfig
H:\>SET MAVEN_JAVA_EXE="C:\bin\jdk1.7.0_60\bin\java.exe"
H:\>for %i in ("c:\bin\apache-maven-3.3.1\bin\.."\boot\plexus-classworlds-*) do set CLASSWORLDS_JAR="%i"
H:\>set CLASSWORLDS_JAR="c:\bin\apache-maven-3.3.1\bin\..\boot\plexus-classworlds-2.5.2.jar"
H:\>set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
H:\>"C:\bin\jdk1.7.0_60\bin\java.exe" -classpath "c:\bin\apache-maven-3.3.1\bin\..\boot\plexus-classworlds-2.5.2.jar" "-Dclassworlds.conf=c:\bin\apache-maven-3.3.1\bin\..\bin\m2.conf" "-Dmaven.home=c:\bin\apache-maven-3.3.1\bin\.." "-Dmaven.multiModuleProjectDirectory=H:\" org.codehaus.plexus.classworlds.launcher.Launcher
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
-hotspot is a synonym for the "server" VM [deprecated]
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
H:\>if ERRORLEVEL 1 goto error
H:\>set ERROR_CODE=1
H:\>if not "" == "" goto skipRcPost
H:\>if exist "H:\\mavenrc_post.bat" call "H:\\mavenrc_post.bat"
H:\>if exist "H:\\mavenrc_post.cmd" call "H:\\mavenrc_post.cmd"
H:\>if "" == "on" pause
H:\>if "" == "on" exit 1
H:\>exit /B 1
H:\>
"-Dmaven.multiModuleProjectDirectory=H:\\"
我的問題。 顯然,java.exe試圖取消轉義字符串\\"
。
java "-Dabc=xyz\\" my.Dummy
對我產生相同的錯誤,而
java "-Dabc=xyz\\\\" my.Dummy
似乎可以工作。
如果使用其他項目目錄路徑,請查看情況是否有所改變,或者嘗試使用"-Dmaven.multiModuleProjectDirectory=H:\\\\"
。
%HOME%
是mvn所查看的環境變量,因此您可能要將其設置為另一個值,或者將其設置為""
,以使maven使用%HOMEDRIVE%%HOMEPATH%
的默認路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.