Jenkins 生成错误消息 Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project

Jenkins build error with message Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project

无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) 在 Jenkins 构建的项目上出现错误消息

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @projectname---
[INFO] 检测到更改 - 重新编译模块!
[INFO] 将 21 个源文件编译到 C:\Program Files (x86)\Jenkins\workspace\projectname\target\classes
[信息]-------------------------------------------- --------------
[错误] 编译错误:
[信息]-------------------------------------------- --------------
[错误] 不再支持源选项 5。使用 7 或更高版本。
[错误] 不再支持目标选项 5。使用 7 或更高版本。
[信息] 2 个错误
[信息]-------------------------------------------- --------------
[信息]-------------------------------------------- ------------------------
[信息]构建失败
[信息]-------------------------------------------- ------------------------
[信息]总时间:13.958 秒
[信息] 完成于:2020-07-30T14:53:55+05:45
[信息]-------------------------------------------- ------------------------
等待 Jenkins 完成数据收集
[错误] 无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Projectname: Compilation failure: Compilation failure:
[错误] 不再支持源选项 5。使用 7 或更高版本。
[错误] 不再支持目标选项 5。使用 7 或更高版本。
[错误] -> [帮助 1]
[错误]
[错误] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。
[JENKINS] 归档 C:\Program Files (x86)\Jenkins\workspace\projectname\pom.xml 到 projectnamegroup/projectname/0.0.1-SNAPSHOT/projectname-0.0.1-SNAPSHOT.pom [错误] 重新 运行 Maven 使用 -X 开关启用完整的调试日志记录。
[错误]
[错误]有关错误和可能的解决方案的更多信息,请阅读以下文章:
[错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
频道已停止
完成:失败

POM 详细信息

 <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>projectnameworkgroup</groupId>
  <artifactId>projectnameframework</artifactId>
  <version>0.0.1-SNAPSHOT</version>
   <name>projecnameautomation</name>
  <url>http://maven.apache.org</url>
 <properties>
   <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 </properties>
 
  
  <build>
 <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M4</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>MYtestNG.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
</plugins>
  </build>


  <dependencies>
     
    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.sikuli/sikuli-api -->
<dependency>
    <groupId>org.sikuli</groupId>
    <artifactId>sikuli-api</artifactId>
    <version>1.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.assertthat/selenium-shutterbug -->
<dependency>
    <groupId>com.assertthat</groupId>
    <artifactId>selenium-shutterbug</artifactId>
    <version>0.9.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.38</version>
</dependency>

   
   <!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
<dependency>
    <groupId>com.opencsv</groupId>
    <artifactId>opencsv</artifactId>
    <version>4.0</version>
</dependency>


<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-clean-plugin</artifactId>
    <version>2.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/ -->
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
</dependency>

     </dependencies>
     
 <repositories>
    <repository>
      <id>mvntestngrepo.read</id>
      <url>https://github.com/abc/projectname</url>
    </repository>
 </repositories>
 
</project>

正在寻找解决方案。请给你宝贵的solution.Thank你

使用版本详情

看起来 maven-compiler-plugin 有默认的 5 个 sourcetarget 选项。
您必须为该选项设置明确的值。
像这样:

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.1</version>
  <configuration>
  <encoding>UTF-8</encoding>
  <source>1.7</source>
  <target>1.7</target>
  </configuration>
</plugin>