Maven 编译,CircleCI 构建因目标版本 17 无效而失败
Maven compile, CircleCI build failing because of invalid target release 17
本地 Maven 构建一切正常,但 CircleCI 管道经常失败。这是我的 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>
还有我的config.yml:
version: 2.1
orbs:
maven: circleci/maven@0.0.12
workflows:
maven_test:
jobs:
- maven/test:
command: '-X compile'
我在 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
我已经看过建议的文章,但它并没有真正告诉我任何信息。我已经尝试切换目标版本并完全删除 pom.xml.
中的属性
正如评论中所指出的,我的 config.yml 存在一些问题。首先,我使用的是旧版本(0.0.12 而不是 1.3.0),另外我必须将 docker Java 17 图像定义为外部执行程序才能使一切正常工作。我现在和工作 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
本地 Maven 构建一切正常,但 CircleCI 管道经常失败。这是我的 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>
还有我的config.yml:
version: 2.1
orbs:
maven: circleci/maven@0.0.12
workflows:
maven_test:
jobs:
- maven/test:
command: '-X compile'
我在 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
我已经看过建议的文章,但它并没有真正告诉我任何信息。我已经尝试切换目标版本并完全删除 pom.xml.
中的属性正如评论中所指出的,我的 config.yml 存在一些问题。首先,我使用的是旧版本(0.0.12 而不是 1.3.0),另外我必须将 docker Java 17 图像定义为外部执行程序才能使一切正常工作。我现在和工作 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