IntelliJ: How do I debug a Maven-GWT project?

I am using IntelliJ IDEA 8.1.2 in Win XP. I have a Maven 3.0.3 project using the GWT 2.4 plugin. It is configured below ...

<!-- GWT Maven Plugin --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>${gwtVersion}</version> <executions> <execution> <goals> <goal>compile</goal> <goal>test</goal> <!-- <goal>i18n</goal> <goal>generateAsync</goal> --> </goals> </execution> </executions> <!-- Plugin configuration. There are many available options, see gwt-maven-plugin documentation at codehaus.org --> <configuration> <runTarget>index.html</runTarget> <hostedWebapp>${webappDirectory}</hostedWebapp> <i18nMessagesBundle>com.cme.clearing.product.client.Messages</i18nMessagesBundle> </configuration> </plugin> 

In IntelliJ, how do I start and debug this project? The only relevant link that Google recommends - http://antonkirillov.wordpress.com/2011/03/22/creating-and-running-gwt-project-using-maven-and-intellij-idea-10/ , is blocked by our firewall company.

If this is useful, I have Tomcat 6.0.33 also locally installed.

Thanks - Dave

+6
source share
3 answers

@ Vijay Krishna, this does not work for me, my decision was.

  • First create mvn gwt: debug. When you start maven, you start the application and listen on port 8000 (click the debug icon).
  • Second, create a remote configuration to connect port 8000.

enter image description here

+7
source

So far, the only way to find 2 launch configurations.

  • One configuration: Run the maven command: mvn gwt: run
  • Second configuration: Remote debugging: specify localhost and 8000 port.

Now do:

  • Run the first launch configuration. Your berth server will start and speak, listening to 8000 ports.
  • Then run the remote debugging setup to listen on this port.
  • Now add any breakpoint to the code, and the debugger should click on it.

So far this is the only way for me. Evn im is looking for a one-click option :)

+3
source

I could configure the IntelliJ debugger to work correctly with maven. This is what I did:

  • This is pom.xml:

     <dependencyManagement> <dependencies> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt</artifactId> <version>2.7.0-SNAPSHOT</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencys> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <!-- "provided" so that we don't deploy --> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-dev</artifactId> <!-- "provided" so that we don't deploy --> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-codeserver</artifactId> <!-- "provided" so that we don't deploy --> <scope>provided</scope> </dependency> </dependencys> <build> <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory> <finalName>rap-maven-1.0</finalName> <resources> <resource> <directory>src/main/resources</directory> </resource> </resources> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>2.7.0-SNAPSHOT</version> <configuration> <logLevel>INFO</logLevel> <style>${gwt.style}</style> <compileReport>true</compileReport> <hostedWebapp>${webappDirectory}</hostedWebapp> <runTarget>index.html</runTarget> <module>Project</module> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>generateAsync</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <executions> <execution> <phase>compile</phase> <goals> <goal>exploded</goal> </goals> </execution> </executions> <configuration> <webappDirectory>${webappDirectory}</webappDirectory> </configuration> </plugin> </plugins> 

  • Create an IntelliJ startup / debug configuration. In my case, my module name is rap-maven and my starting web page is test.html

IntelliJ Run / Debug Configuration

  1. As I configured gwt-maven-plugin and maven-war-plugin, in the package phase they generate an exploded directory in target \ rap-maven-1.0 and the gwt module executed in target \ rap-maven-1.0 \ project , so you need to configure the structure project as shown:

In GWT Facet, OutputRelativePath should be /target/rap-maven-1.0/project :

Gwt facet

And in Web Facet, the web resource directory should be in C: \ Proyectos \ Vulcano \ RAP \ rap-maven \ target \ rap-maven-1.0 :

Web facet

Script link in test.html file

 <script type="text/javascript" language="javascript" src="project/project.nocache.js"></script> 

Hope this can be helpful.

-1
source

Source: https://habr.com/ru/post/901540/


All Articles