如何为 Maven java 项目设置 Maven 调试配置文件

How to set up a maven debug profile for a maven java project

我正在尝试在 Eclipse Photon 2018/12 中调试 Maven cucumber-serenity Java 项目。 请告诉我如何设置 maven 调试配置文件和 运行 以便我可以通过设置断点来调试代码。

这取决于您的需求。如果你想调试测试,只需使用这个配置文件:

<project
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <packaging>...</packaging>

    <repositories>
        ...
    </repositories>

    <distributionManagement>
        ...
    </distributionManagement>

    <profiles>
        <profile>
            <id>debug</id>
            <properties>
                <maven.surefire.debug>test</maven.surefire.debug>
            </properties>
        </profile>
    </profiles>

    <build>
        ...
    </build>

    <dependencies>
        ...
    </dependencies>
</project>

但如果不是这种情况,那么您可以简单地配置 Eclipse IDE 执行 this.

希望对您有所帮助。