作者:卟懵de珍惜_463 | 来源:互联网 | 2023-10-15 17:40
Iamonwindowsenvironmentandusingmaventocompilemyproject.AlthoughIjustcreatedtheproje
I am on windows environment and using maven to compile my project. Although I just created the project and added the dependencies for various libararies.
我使用windows环境并使用maven编译我的项目。尽管我刚刚创建了这个项目并添加了各种libararies的依赖项。
As I added them maven started complaining for the missing tools.jar
, so i added below to my pom.xml
:
当我添加它们时,maven开始抱怨缺少的工具。jar,所以我在我的pom.xml中添加了如下内容:
com.sun
tools
1.6
system
${java.home}/../lib/tools.jar
When i ran the maven install, i got an error for the missing jar as below :
当我运行maven安装时,丢失的jar有一个错误,如下所示:
[ERROR] Failed to execute goal on project GApp: Could not resolve dependencies for project GApp:GApp:war:0.0.1-SNAPSHOT: Could not find artifact com.sun:tools:jar:1.6 at specified path C:\Program Files\Java\jre6\lib\tools.jar -> [Help 1]
The issue is that the tools.jar
is in "C:\Program Files\Java\jdk1.6.0_26\lib
" and is correctly set in the JAVA_HOME
environment variable but the maven is still looking in jre folder as in error message "C:\Program Files\Java\jre6\lib\tools.jar
".
问题是这些工具。jar在“C:\程序文件\Java\jdk1.6.0_26\lib”中,并且在JAVA_HOME环境变量中正确设置,但是maven仍然在jre文件夹中查找错误消息“C:\程序文件\Java\jre6\lib工具.jar”。
C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_26
Interestingly: when i set the full path in dependency, it worked just fine. But i don't want to hard code it.
有趣的是:当我设置依赖项的完整路径时,它工作得很好。但我不想硬编码。
com.sun
tools
1.6
system
C:\Program Files\Java\jdk1.6.0_26\lib\tools.jar
Can someone suggest any dynamic solution for this?
<