I'm trying to run Maven on cygwin. I've added maven to the path and my Java home looks like this:
我想在cygwin上运行Maven。我在路径中添加了maven,我的Java主页看起来是这样的:
$ echo $JAVA_HOME
/cygdrive/c/Program Files/Java/jdk1.6.0
Yet when I try to run mvn --version
, I get this:
但是当我尝试运行mvn版本时,我得到了:
Error: JAVA_HOME is not defined correctly.
We cannot execute /cygdrive/c/Program Files/Java/jdk1.7.0_01/bin/java
Any idea why it's not working? Java -version works fine, so it's not a problem with java. I've also tried jdk1.6.0 instead.
你知道它为什么不工作吗?Java版本工作得很好,所以这不是Java的问题。我还尝试了jdk1.6.0。
Running which java
gives,
运行java提供了,
$ which java
/cygdrive/c/windows/system32/java
and java -version
gives,
和java - version,
$ java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode, sharing)
6 个解决方案
#1
17
I had the same problem and solved it like this: If I run mvn.bat instead of mvn, I did not have this problem.
我遇到了同样的问题,并像这样解决了:如果我运行mvn。而不是mvn,我没有这个问题。
So, since Cygwin will run the mvn file, I replaced this mvn file with a softlink (ln -s mvn.bat mvn) to the bat file. This way, running mvn will silently run the mvn.bat which handles these problems gracefully.
因此,由于Cygwin将运行mvn文件,所以我用一个softlink (ln -s mvn)替换了这个mvn文件。bat mvn)到bat文件。这样,运行mvn将静默运行mvn。bat,优雅地处理这些问题。
#2
10
Anyone Using Cygwin and Maven, here's exactly what you need...
任何使用Cygwin和Maven的人,这里正是您需要的……
In your Cygwin bash prompt:
在您的Cygwin bash提示符:
$ vim ~/.bashrc
or $ nano ~/.bashrc
(Which ever you fancy...)
vim ~ /美元。bashrc或$ nano ~/。bashrc(无论你怎么想…)
Append the following:
添加如下:
alias mvn=mvn.bat
别名mvn = mvn.bat
Save & Exit. Then run:
保存和退出。然后运行:
$ source ~/.bashrc
$ ~ / . bashrc来源
Now you should be able to use the 'mvn' command as you do in cmd prompt.
现在您应该可以像在cmd提示符中那样使用“mvn”命令了。
#3
3
cygwin uses a dos console to execute maven builds (mvn.bat).
cygwin使用dos控制台执行maven构建。
Set your java home to the c:\Program Files\Java\jdk1.7.0_01
设置您的java的c:\Program Files\Java\ jdk1.7.0_01
#4
0
A flashback from Win95 days - could setting JAVA_HOME to /cygdrive/c/Progra~1/Java/jdk1.6.0
help?
Win95的闪回——将JAVA_HOME设置为/cygdrive/c/ proa ~1/Java/jdk1.6.0会有帮助吗?
#5
0
I came across a bug between the "mvn" script and shell globbing on cygwin.
我在“mvn”脚本和cygwin上的shell globbing之间遇到了一个bug。
See: maven error when running in cygwin?
参见:在cygwin中运行时的maven错误?
#6
0
I was facing the same problem while running gradle from cygwin tool.
在cygwin工具上运行gradle时,我遇到了同样的问题。
I used to set the java home including the bin folder
我曾经设置java home,包括bin文件夹
C:\Program Files\Java\jdk1.7.0_67\bin
But later i realized that some application do not recognize if u include bin folder, so i changed the class path to C:\Program Files\Java\jdk1.7.0_67
and it started working.
但后来我意识到,一些应用程序不承认如果你包括bin文件夹,所以我改变了类路径C:\Program Files\Java\ jdk1.7.0_67开始工作。
#1
17
I had the same problem and solved it like this: If I run mvn.bat instead of mvn, I did not have this problem.
我遇到了同样的问题,并像这样解决了:如果我运行mvn。而不是mvn,我没有这个问题。
So, since Cygwin will run the mvn file, I replaced this mvn file with a softlink (ln -s mvn.bat mvn) to the bat file. This way, running mvn will silently run the mvn.bat which handles these problems gracefully.
因此,由于Cygwin将运行mvn文件,所以我用一个softlink (ln -s mvn)替换了这个mvn文件。bat mvn)到bat文件。这样,运行mvn将静默运行mvn。bat,优雅地处理这些问题。
#2
10
Anyone Using Cygwin and Maven, here's exactly what you need...
任何使用Cygwin和Maven的人,这里正是您需要的……
In your Cygwin bash prompt:
在您的Cygwin bash提示符:
$ vim ~/.bashrc
or $ nano ~/.bashrc
(Which ever you fancy...)
vim ~ /美元。bashrc或$ nano ~/。bashrc(无论你怎么想…)
Append the following:
添加如下:
alias mvn=mvn.bat
别名mvn = mvn.bat
Save & Exit. Then run:
保存和退出。然后运行:
$ source ~/.bashrc
$ ~ / . bashrc来源
Now you should be able to use the 'mvn' command as you do in cmd prompt.
现在您应该可以像在cmd提示符中那样使用“mvn”命令了。
#3
3
cygwin uses a dos console to execute maven builds (mvn.bat).
cygwin使用dos控制台执行maven构建。
Set your java home to the c:\Program Files\Java\jdk1.7.0_01
设置您的java的c:\Program Files\Java\ jdk1.7.0_01
#4
0
A flashback from Win95 days - could setting JAVA_HOME to /cygdrive/c/Progra~1/Java/jdk1.6.0
help?
Win95的闪回——将JAVA_HOME设置为/cygdrive/c/ proa ~1/Java/jdk1.6.0会有帮助吗?
#5
0
I came across a bug between the "mvn" script and shell globbing on cygwin.
我在“mvn”脚本和cygwin上的shell globbing之间遇到了一个bug。
See: maven error when running in cygwin?
参见:在cygwin中运行时的maven错误?
#6
0
I was facing the same problem while running gradle from cygwin tool.
在cygwin工具上运行gradle时,我遇到了同样的问题。
I used to set the java home including the bin folder
我曾经设置java home,包括bin文件夹
C:\Program Files\Java\jdk1.7.0_67\bin
But later i realized that some application do not recognize if u include bin folder, so i changed the class path to C:\Program Files\Java\jdk1.7.0_67
and it started working.
但后来我意识到,一些应用程序不承认如果你包括bin文件夹,所以我改变了类路径C:\Program Files\Java\ jdk1.7.0_67开始工作。