Jenkins生成错误并显示消息失败,无法在项目

时间:2020-07-30 10:45:09

标签: jenkins maven-3

无法在Jenkins构建中的项目上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile(默认编译)

[INFO] --- maven-compiler-plugin:3.1:compile(默认编译)@ projectname ---
[INFO]检测到更改-重新编译模块!
[INFO]将21个源文件编译为C:\ Program Files(x86)\ Jenkins \ workspace \ projectname \ target \ classes
[INFO] ----------------------------------------------- --------------
[ERROR]编译错误:
[INFO] ----------------------------------------------- --------------
[错误]不再支持源选项5。使用7或更高版本。
[错误]不再支持目标选项5。使用7或更高版本。
[INFO] 2个错误
[INFO] ----------------------------------------------- --------------
[INFO] ----------------------------------------------- -------------------------
[INFO]建立失败
[INFO] ----------------------------------------------- -------------------------
[INFO]总时间:13.958 s
[INFO]结束于:2020-07-30T14:53:55 + 05:45
[INFO] ----------------------------------------------- -------------------------
等待詹金斯完成数据收集
[错误] 无法在项目Projectname上执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile(默认编译)::编译失败:
[错误]不再支持源选项5。使用7或更高版本。
[错误]不再支持目标选项5。使用7或更高版本。
[错误]-> [帮助1]
[错误]
[ERROR]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。
[JENKINS]将C:\ Program Files(x86)\ Jenkins \ workspace \ projectname \ pom.xml归档到projectnamegroup / projectname / 0.0.1-SNAPSHOT / projectname-0.0.1-SNAPSHOT.pom [错误]使用-X开关重新运行Maven以启用完整的调试日志记录。
[错误]
[ERROR]有关错误和可能的解决方案的详细信息,请阅读以下文章:
[错误] [帮助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>

正在寻找解决方案。请提供您宝贵的解决方案。谢谢

使用的版本详细信息

enter image description here

1 个答案:

答案 0 :(得分:0)

看起来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>