java - 如何使用 Maven Eclipse 和 glassfish 调试 Web 应用程序?

标签 java eclipse debugging maven glassfish

我创建了简单的 Web 应用程序作为 Maven 项目。运行 mvn eclipse:eclipse 并将其导入 Eclipse 工作空间。我也有一条 Glassfish 。我运行 Maven 目标“全新安装”并添加属性:

maven.compilet.debug=true
maven.compilet.debuglevel=lines,vars,sources

我使用 Eclipse 的属性运行此目标并获取 war 存档。接下来,我将 war 导入工作区,然后单击 glassfish 上的“添加和删除”,在“发布到 Glassfish”过程项目期间,我收到错误:

Unable to install breakpoint SomeClass s_ss_WeldSubdass due to missing line number attributes. Modify compiler options to generate line number attributes.

Reason:
Absent Line Number Information

我还检查网络服务器属性:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009

并从管理控制台检查在 9009 端口上启用了调试。

问题是什么?

P.S.可以创建断点,但调试将在未知行中。

最佳答案

您可以尝试将调试选项添加到您的 Maven 编译器插件配置中。默认情况下它的值为true,但也许你的maven编译器插件配置不是很好。事情大概是这样的,

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
                <debug>true</debug>
            </configuration>
        </plugin>

关于java - 如何使用 Maven Eclipse 和 glassfish 调试 Web 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17121447/

相关文章:

java - JAXB 保留传递给 Marshaller 的对象

java - 是否可以通过其方法更改对象的运行时类型?

c++ - VS2013 遇到基类位于未命名命名空间中的问题

java - 将当前选定的测试类作为参数的 Eclipse Junit 运行配置?

java - 小部件的 Eclipse e4 图像图标以及如何让它们方便使用

c# - 无法找到运行时 clr.dll 以使用 sos

javascript - 用于 node.js 的 Webstorm 调试器

java - 在 AbstractFactory 中声明静态方法的缺点

java - 最终标识符是必要的,为什么?

java - Hibernate 不更新搜索 hibernate.cfg.xml 的路径