Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/design-patterns/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 未能执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile_Java_Maven_Jenkins_Jenkins Pipeline_Pom.xml - Fatal编程技术网

Java 未能执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile

Java 未能执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile,java,maven,jenkins,jenkins-pipeline,pom.xml,Java,Maven,Jenkins,Jenkins Pipeline,Pom.xml,我正在通过Jenkins文件运行此命令: sh“${mvnHome}/bin/mvn干净包” 得到这个错误: 未能在项目自动化上执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile(默认编译):严重错误编译:无效目标版本:11-> 当我在本地(使用IntelliJ终端)运行此命令时,它会正常工作!! 詹金斯服务器和我的电脑的mvn版本均为3.6.0 我的pom: <?xml version="1.0" enc

我正在通过Jenkins文件运行此命令: sh“${mvnHome}/bin/mvn干净包”

得到这个错误: 未能在项目自动化上执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile(默认编译):严重错误编译:无效目标版本:11->

当我在本地(使用IntelliJ终端)运行此命令时,它会正常工作!! 詹金斯服务器和我的电脑的mvn版本均为3.6.0

我的pom:

<?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>automation</groupId>
    <artifactId>automation</artifactId>
    <version>1.0-SNAPSHOT</version>

    <profiles>
        <profile>
            <id>ssl-profile</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>central-1</id>
                    <url>https://repo1.maven.org/maven2</url>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>central-2</id>
                    <url>https://repo1.maven.org/maven2</url>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

    <dependencies>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>1.18.12</version>
                <scope>provided</scope>
            </dependency>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.1.0</version>
            <scope>test</scope>
        </dependency>

            <dependency>
                <groupId>com.sun.mail</groupId>
                <artifactId>javax.mail</artifactId>
                <version>1.6.2</version>
            </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.9.8</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.restassured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>2.9.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>3.1.0</version>
        </dependency>
        <!-- Java 6 = JAX-B Version 2.0   -->
        <!-- Java 7 = JAX-B Version 2.2.3 -->
        <!-- Java 8 = JAX-B Version 2.2.8 -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-osgi</artifactId>
            <version>2.3.0.1</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.3</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>13.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.11.3</version>
        </dependency>
        <dependency>
            <groupId>com.twilio.sdk</groupId>
            <artifactId>twilio</artifactId>
            <version>7.34.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.4.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.16</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.5</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>3.1.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility-proxy</artifactId>
            <version>3.1.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.oauth-client</groupId>
            <artifactId>google-oauth-client-jetty</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-sheets</artifactId>
            <version>v4-rev516-1.23.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.github.fge/json-schema-validator -->
        <dependency>
            <groupId>com.github.fge</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>2.2.6</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.github.fge/jackson-coreutils -->
        <dependency>
            <groupId>com.github.fge</groupId>
            <artifactId>jackson-coreutils</artifactId>
            <version>1.8</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.github.fge/json-schema-core -->
        <dependency>
            <groupId>com.github.fge</groupId>
            <artifactId>json-schema-core</artifactId>
            <version>1.2.5</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.21.0</version>
                    <configuration>
                        <properties>
                            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                            <property>
                                <name>listener</name>
                                <value>test_listener.TestListener</value>
                            </property>
                        </properties>
                        <systemPropertyVariables>
                            <kobi>old</kobi>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                    <configuration>
                        <source>11</source>
                        <target>11</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.json</include>
                    <include>**/*.xsd</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.json</include>
                </includes>
            </resource>
        </resources>
    </build>

</project>

4.0.0
自动化
自动化
1.0-快照
ssl配置文件
真的
中央-1
https://repo1.maven.org/maven2
假的
中环-2
https://repo1.maven.org/maven2
假的
org.projectlombok
龙目
1.18.12
假如
朱尼特
朱尼特
4.12
测试
org.junit.jupiter
朱尼特木星发动机
5.1.0
测试
com.sun.mail
javax.mail
1.6.2
com.fasterxml.jackson.core
杰克逊数据绑定
2.9.8
com.jayway.restassed
放心
2.9.0
编译
放心吧
json模式验证器
3.1.0
javax.xml.bind
jaxb api
2.3.0
com.sun.xml.bind
jaxb内核
2.3.0.1
com.sun.xml.bind
jaxb impl
2.3.0.1
com.sun.xml.bind
jaxb osgi
2.3.0.1
公地小海狸
公地小海狸
1.9.3
org.jetbrains
注释
13
编译
公地郎
公地郎
2.2
org.jsoup
jsoup
1.11.3
com.twilio.sdk
斜纹夜叉
7.34.1
通用验证器
通用验证器
1.4.0
mysql
mysql连接器java
8.0.16
javax.mail
邮件
1.4.5
javax.mail
javax.mail-api
1.6.2
等待性
等待
3.1.6
测试
等待性
等待代理
3.1.6
测试
com.google.api-client
谷歌api客户端
1.23.0
com.google.oauth-client
谷歌oauth客户端jetty
1.23.0
com.google.api
谷歌api服务表
v4-rev516-1.23.0
com.github.fge
json模式验证器
2.2.6
com.github.fge
杰克逊·科鲁蒂尔斯
1.8
com.github.fge
json模式核心
1.2.5
org.apache.maven.plugins
maven surefire插件
2.21.0
UTF-8
听众
test_listener.TestListener
古老的
org.apache.maven.plugins
maven编译器插件
3.8.1
11
11
src/main/java
**/*.json
**/*.xsd
src/main/resources
**/*.json

问题在于我的Jenkins服务器使用的java版本(他使用的是JAVA7,我使用的是Java11)

1。您配置了两次maven编译器插件,这是不明智的。2.您曾经配置过Java8和Java10。你想要什么?请注意,不应再使用Java10,请使用Java8、11或最新版本。谢谢您的回答。我更新了我的POM(在我的帖子中)。它对我仍然不起作用。“未能在项目自动化上执行目标org.apache.maven.plugins:maven编译器plugin:3.8.1:compile(默认编译):编译致命错误:无效目标版本:11->”您应该使用java 11运行maven目标。为此,您应该设置JAVA_HOME和JAVACMD变量。例如export JAVACMD=/usr/lib/jvm/java-11-openjdk-amd64/bin/java export java_HOME=/usr/lib/jvm/java-11-openjdk-amd64/我应该在哪里设置这些变量?