简体   繁体   English

pom文件java tools.jar问题

[英]pom file java tools.jar issue

I execute 我执行

mvn install

And get the following error: 并得到以下错误:

[ERROR] Failed to execute goal on project 1: Could not resolve dependencies for project 1:1:jar:0.0.1-SNAPSHOT: Could not find artifact 
com.sun:tools:jar:1.6.0 at specified path C:\Program Files\Java\jdk1.7.0_21\lib -> [Help 1]

This is how I'm specifying location for tools.jar: 这是我为tools.jar指定位置的方式:

<profiles>
<profile>
    <id>windows_profile</id>
    <activation>
        <activeByDefault>false</activeByDefault>
        <os>
            <family>windows</family>
        </os>
    </activation>
    <properties>
        <toolsjar>C:\Program Files\Java\jdk1.7.0_21\lib</toolsjar>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.6.0</version>
            <scope>system</scope>
            <systemPath>${toolsjar}</systemPath>
        </dependency>
    </dependencies>
</profile>
</profiles>

Maybe I should specify the full path here? 也许我应该在这里指定完整路径?

 <systemPath>${toolsjar}</systemPath>

You need to specify the path to the jar itself, not to the directory containing the jar. 您需要指定jar本身的路径,而不是包含jar的目录的路径。

<properties>
    <toolsjar>C:\Program Files\Java\jdk1.7.0_21\lib</toolsjar>
</properties>

should be something like 应该是这样的

<properties>
    <toolsjar>C:\Program Files\Java\jdk1.7.0_21\lib\tools.jar</toolsjar>
</properties>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM