How to recompile a maven dependency in required java version?

问题描述 投票:0回答:0

我有以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project camelActiveMqReceiver: Compilation failure
[ERROR] /Users/pranscha/Projects/REPRODUCIBLES/camelActiveMqReceiver/src/main/java/com/camelmicroservices/camelActiveMqReceiver/routes/CamelReceiverRouter.java:[3,24] cannot access org.apache.camel.Exchange
[ERROR]   bad class file: /Users/pranscha/.m2/repository/org/apache/camel/camel-api/3.20.4/camel-api-3.20.4.jar(org/apache/camel/Exchange.class)
[ERROR]     class file has wrong version 55.0, should be 52.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.

即使在添加之后:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>

失败的依赖是:

        <dependency>
            <groupId>org.apache.camel.springboot</groupId>
            <artifactId>camel-spring-boot-starter</artifactId>
            <version>${camel.version}</version>
        </dependency>

我期待 org/apache/camel/Exchange.class Java 类在我的项目中使用 1.8 版本编译正常工作,但即使在添加 maven.compiler.source & maven.compiler.target 之后,它也不起作用。

java maven compiler-errors apache-camel
© www.soinside.com 2019 - 2024. All rights reserved.