Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

eclipse - Missing artifact "sun.jdk:jconsole:jar:jdk"

When adding Arquillian to a Maven build I get the above exception in Eclipse:

Missing artifact sun.jdk:jconsole:jar:jdk

    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <version>1.1.7.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-persistence-dbunit</artifactId>
        <version>1.0.0.Alpha7</version>
    </dependency>

(The message is not the problem, but that Eclipse refuses to compile the project because of it. Maven works, though.)

Naturally the first thing I did was trying to exclude it from the Maven dependencies (wildfly-arquillian-container-managed is where the dependency tree states the dependency comes from):

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-managed</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>jconsole</artifactId>
                <groupId>sun.jdk</groupId>
            </exclusion>
        </exclusions>
    </dependency> 

There was no change. I tried to start Eclipse with -vm C:Program FilesJavajdk1.8.0_60in. And tried to edit the JDK in "Preferences -> Installed JREs" to contain the JAR in the tools directory. But nothing works.

What can I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I put my dependencies like this and it works fine:

<dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-arquillian-container-embedded</artifactId>
        <version>8.1.0.CR1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.15</version>
        <scope>test</scope>
    </dependency>
    <!-- Arquillian -->

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-embedded</artifactId>
        <version>8.1.0.CR1</version>
        <exclusions>
            <exclusion>
                <groupId>sun.jdk</groupId>
                <artifactId>jconsole</artifactId>
            </exclusion>
        </exclusions>
        <scope>test</scope>
    </dependency>

See that the exclusion tag is in the "wildfly-embedded" dependency...

Don't forget to command "mvn install" and click right button at project and "Maven Update", if it doesn't work try delete folder "~/.m2/repository" and download all the dependencies again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...