【问题标题】:ERROR:Some problems were encountered while processing the POMs:错误:处理 POM 时遇到一些问题:
【发布时间】:2020-12-16 04:52:25
【问题描述】:

我正在尝试在我的 Jenkins 中运行从 https://github.com/kishancs2020/TicketBookingServiceJunitTesting Github 获取的源代码,以查看在源代码的 Jenkinsfile 中创建的管道。

我已经更新了 maven,java 版本来修复它,但错误仍然是一样的。我也浏览了这个链接 http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException 但找不到解决方案。任何修复此错误的建议。

+ mvn clean -f TicketBookingServiceJunitTesting
POM file TicketBookingServiceJunitTesting specified with the -f/--file command line argument does not exist
[[1;34mINFO[m] Scanning for projects...
[[1;31mERROR[m] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM /var/lib/jenkins/workspace/ervicejunittesting-master_master/TicketBookingServiceJunitTesting: /var/lib/jenkins/workspace/ervicejunittesting-master_master/TicketBookingServiceJunitTesting (No such file or directory) @ 
 @ 
[[1;31mERROR[m] The build could not read 1 project -> [1m[Help 1][m
[[1;31mERROR[m]   
[[1;31mERROR[m]   The project  (/var/lib/jenkins/workspace/ervicejunittesting-master_master/TicketBookingServiceJunitTesting) has 1 error
[[1;31mERROR[m]     Non-readable POM /var/lib/jenkins/workspace/ervicejunittesting-master_master/TicketBookingServiceJunitTesting: /var/lib/jenkins/workspace/ervicejunittesting-master_master/TicketBookingServiceJunitTesting (No such file or directory)
[[1;31mERROR[m] 
[[1;31mERROR[m] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[[1;31mERROR[m] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[[1;31mERROR[m] 
[[1;31mERROR[m] For more information about the errors and possible solutions, please read the following articles:
[[1;31mERROR[m] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

这是 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>com.infotech.book.ticket.app</groupId>
    <artifactId>TicketBookingRestApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>TicketBookingRestApp</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.7.RELEASE</version>
        <relativePath />
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

我可以知道为什么它说 pom.xml 不可读吗?管道仅在 git repo & clean 阶段成功。

【问题讨论】:

标签: java maven jenkins


【解决方案1】:

maven 中的-f 标志用于指定当前文件夹中除pom.xml 文件之外的 pom 文件,这就是您收到异常的原因。

如果要测试特定的测试类-Dtest切换指定测试类

参考号:https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-06
    • 2020-02-27
    • 2015-07-01
    • 2020-11-01
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多