有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java使用maven添加调试符号

我试图通过使用mave编译器插件添加调试符号(这样我就可以访问方法参数名)。 遵循here中的可用配置, 这是我的maven编译器插件配置

                        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
                <debug>true</debug>
                <debugLevel>lines,vars,source</debugLevel>
            </configuration>
        </plugin>

直到现在,我还没有成功

有人能告诉我如何使用maven添加调试符号吗


共 (1) 个答案

  1. # 1 楼答案

    您可能需要根据compilerArgumentmaven-compiler-plugin documentation添加<fork>true</fork>

    Sets the unformatted single argument string to be passed to the compiler if fork is set to true.

    不确定是否需要,但您可能需要添加<groupId>org.apache.maven.plugins</groupId><version>#.#.#<\version>

    此外,正如@JonK在评论中提到的,你需要source而不是sources来表示debugLevel