简体   繁体   English

Maven 编译,CircleCI 构建失败,因为目标版本 17 无效

[英]Maven compile, CircleCI build failing because of invalid target release 17

Locally Maven builds everything fine but the CircleCI pipeline constantly fails.本地 Maven 构建一切正常,但 CircleCI 管道不断失败。 Here is my pom.xml:这是我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>at.jku</groupId>
    <artifactId>SmartRoom</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.3.3</version>
        </dependency>
    </dependencies>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

</project>

And my config.yml:还有我的 config.yml:

version: 2.1

orbs:
  maven: circleci/maven@0.0.12

workflows:
  maven_test:
    jobs:
      - maven/test:
          command: '-X compile'

The error message I am getting in CircleCI:我在 CircleCI 中收到的错误消息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project SmartRoom: Fatal error compiling: invalid target release: 17 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

I already looked at the suggested article but it doesn't really tell me anything.我已经看过建议的文章,但它并没有真正告诉我任何信息。 I already tried switching target versions and also completely deleting the properties from the pom.xml.我已经尝试切换目标版本并完全删除 pom.xml 中的属性。

As pointed out in the comments, there were a few problems with my config.yml.正如评论中指出的那样,我的 config.yml 存在一些问题。 First of all I was using an old version (0.0.12 instead of 1.3.0) and additionally I had to define the docker Java 17 image as an external executor to get everything working.首先,我使用的是旧版本(0.0.12 而不是 1.3.0),另外我必须将 docker Java 17 图像定义为外部执行程序才能使一切正常工作。 My current and working config.yml:我当前和工作的 config.yml:

version: 2.1
executors:
  java17:
    docker:
      - image: 'cimg/openjdk:17.0'
orbs:
  maven: circleci/maven@1.3.0
workflows:
  maven_test:
    jobs:
      - maven/test:
          command: '-X compile'
          executor: java17

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM