简体   繁体   English

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

[英]How debug web application with maven Eclipse and glassfish?

I create simple web application as maven project. 我将简单的Web应用程序创建为Maven项目。 Run mvn eclipse:eclipse and import it into Eclipse worck space. 运行mvn eclipse:eclipse并将其导入Eclipse worck空间。 I also has a Glassfish. 我也有一个玻璃鱼。 I run maven goal "clean install" and add properties: 我运行Maven目标“全新安装”并添加属性:

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

I run this goal with properties from Eclipse and get war archive. 我使用Eclipse的属性运行此目标并获取战争存档。 Next I imported war into workspace then click "add and remove" on glassfish and during an "Publish to Glassfish" process project I get and error: 接下来,我将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

I also check web server properties: 我还检查Web服务器属性:

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

And check from admin console that debug enabled on 9009 port. 然后从管理控制台检查9009端口上是否启用调试。

What is the problem? 问题是什么?

PS I can create a breakpoint, but debug will be in unknow line. PS可以创建一个断点,但调试将在未知行中进行。

You could try adding debug options to your maven compiler plugin configuration. 您可以尝试将调试选项添加到您的maven编译器插件配置中。 By default its value is true, but perhaps your configuration for maven compiler plugin is not in a good way. 默认情况下,它的值为true,但是也许您对maven编译器插件的配置不是很好。 It would be something like this, 这样的话

        <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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM