0

从 Java 8 升级到 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

我正在使用 IntelliJ

我的 pom 文件

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

我试图通过将其添加到 pom 文件来解决此问题:

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

我运行这个命令来构建项目

mvn clean install -DskipTests
4

0 回答 0