What is wrong with my Maven Config?

前端 未结 3 488
你的背包
你的背包 2021-01-25 02:10

I want to checkout sonar, so I added the following snippet to my pom.xml the dependency part was taken from http://maven.apache.org/general.html#tools-jar-dependency

<         


        
相关标签:
3条回答
  • 2021-01-25 02:41

    Are you running this in eclipse? If the answer is yes, this is an annoying and very misunderstood problem. Take a look at my answer here

    You may not be pointing eclipse to the right jre/jdk when you're starting up (this is something you didn't necessarily configure rather was Windows)

    0 讨论(0)
  • 2021-01-25 02:47

    A problem I had once was different location of tools.jar under Mac OS. Here's the profiles section to solve the problem:

    <profiles>
        <profile>
            <id>java-home-parent-lib-tools-jar</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <file>
                    <exists>${java.home}/../lib/tools.jar</exists>
                </file>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>sun.jdk</groupId>
                    <artifactId>tools</artifactId>
                    <version>1.5.0</version>
                    <scope>system</scope>
                    <systemPath>${java.home}/../lib/tools.jar</systemPath>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>java-home-parent-classes-classes-jar</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <file>
                    <exists>${java.home}/../Classes/classes.jar</exists>
                </file>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>sun.jdk</groupId>
                    <artifactId>tools</artifactId>
                    <version>1.5.0</version>
                    <scope>system</scope>
                    <systemPath>${java.home}/../Classes/classes.jar</systemPath>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
    

    However I am not sure this is something you're facing.

    0 讨论(0)
  • 2021-01-25 02:59

    If your JAVA_HOME points to your jdk (e.g./usr/lib/jvm/jdk1.6.0_33), your tools.jar configuration (${java.home}/../lib/tools.jar) indicates that there should be a tools jar with the following path: /usr/lib/jvm/lib/tools.jar.

    If you change the tools jar path to ${java.home}/lib/tools.jar and verify that in your JAVA_HOME/lib there is the tools.jar file, it should work.

    There you can find the related jira.

    0 讨论(0)
提交回复
热议问题