6

I'm using IntelliJ IDEA 8.1.2 on 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 run 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 company firewall.

If it is of any use, I have Tomcat 6.0.33 also installed locally.

Thanks, - Dave

Dave
  • 15,639
  • 133
  • 442
  • 830
  • Contact your admin to to permit this address, linked tutorial should help. Your combination of cutting edge Maven and GWT versions and ancient IntelliJ IDEA version is quite surprising. It might work, but I'd recommend using IDEA 10.5.2. – CrazyCoder Nov 15 '11 at 17:51

3 Answers3

7

@Vijay Krishna this doesn't work for me, my solution was.

  1. First, create a mvn gwt:debug. When you run maven will start your application, and listen to port 8000(click on debug icon).
  2. Second, Create a Remote configuration to connect port 8000.

enter image description here

Bernardo Vale
  • 3,224
  • 4
  • 21
  • 34
4

So far the only way i found is to create 2 run configurations.

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

Now do :

  • Start the first run configurations. Your jetty server will start and says listening to 8000 port.
  • Then Start remote debug configuration to listen to that port.
  • Now put any break point in the code and debugger should hit it.

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

Vijay Krishna
  • 888
  • 2
  • 8
  • 20
-1

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

  1. This is the 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>
    

  2. Create a IntelliJ Run/Debug Configuration. In my case my module name is rap-maven and my start web page is test.html

IntelliJ Run/Debug Configuration

  1. As i configured the gwt-maven-plugin and maven-war-plugin, in package phase they generate the war exploded directory in target\rap-maven-1.0 and the gwt complied module in target\rap-maven-1.0\project, so you need to configure the Project Structure as indicates:

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

GWT Facet

And in Web Facet, the Web Resource Directory must be in C:\Proyectos\Vulcano\RAP\rap-maven\target\rap-maven-1.0:

Web Facet

The script link in test.html is

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

Hope this can be uselful.

teteArg
  • 3,684
  • 2
  • 20
  • 18