1

I get this error after upgrading from Java 8 to Java 16

  Could not resolve dependencies for project com.berwick:bds-core:war:1.0-SNAPSHOT: Could not find artifact sun.jdk:jconsole:jar:jdk at specified path /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home/../lib/jconsole.jar

JAVA_HOME --> /Library/Java/JavaVirtualMachines/jdk-16.0.1.jdk/Contents/Home

I am using IntelliJ

my pom file

<properties>
    <java.version>16</java.version>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    ..... 
</properties>

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <source>${java.version}</source> <!-- depending on your project -->
            <target>${java.version}</target> <!-- depending on your project -->
            <annotationProcessorPaths>
                <path>
                    <groupId>org.mapstruct</groupId>
                    <artifactId>mapstruct-processor</artifactId>
                    <version>${org.mapstruct.version}</version>
                </path>
            </annotationProcessorPaths>
        </configuration>
    </plugin>

....
</plugins>

I tried to fix the issue by adding this to pom file:

<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>

I run this command to build the project

mvn clean install -DskipTests
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156
  • Does this answer your question? [Missing artifact "sun.jdk:jconsole:jar:jdk"](https://stackoverflow.com/questions/33236195/missing-artifact-sun-jdkjconsolejarjdk) – Alberto Sinigaglia Apr 26 '21 at 14:14
  • What project are you upgrading? Is there a minimal reproducible example for this? There could possibly be a lot of reasons for a project not being able to resolve dependencies. – Naman Apr 26 '21 at 14:17
  • Looks like this problem can be solved by upgrading the dependency that is compatible with Java 9 and above since it uses `sun.jdk`. Read the migration guide, specifically about `jdkinternals`. – Aniket Sahrawat Apr 26 '21 at 14:24
  • I update my question, I am tried a lot of stuff with no luck I wonder where to start – Mina Fawzy Apr 26 '21 at 14:26
  • @MinaFawzy how about upgrading `wildfly-embedded` to its latest version and giving it a shot? – Naman Apr 26 '21 at 14:46

0 Answers0