1 package org.codehaus.mojo.gwt.shell;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.plugin.MojoExecutionException;
23 import org.apache.maven.plugin.MojoFailureException;
24 import org.apache.maven.plugins.annotations.Mojo;
25 import org.apache.maven.plugins.annotations.Parameter;
26 import org.apache.maven.plugins.annotations.ResolutionScope;
27
28
29
30
31
32
33
34 @Mojo(name = "debug", requiresDirectInvocation = true, requiresDependencyResolution = ResolutionScope.TEST)
35 public class DebugMojo
36 extends RunMojo
37 {
38
39
40
41
42 @Parameter(defaultValue = "8000", property = "gwt.debugPort")
43 private int debugPort;
44
45
46
47
48 @Parameter(defaultValue = "true", property = "gwt.debugSuspend")
49 private boolean debugSuspend;
50
51
52
53
54 @Parameter(defaultValue = "false", property = "attachDebugger")
55 private boolean attachDebugger;
56
57
58
59
60
61
62
63
64 @Override
65 public String getExtraJvmArgs()
66 {
67 String extras = super.getExtraJvmArgs();
68 extras += " -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket";
69 extras += ",server=" + ( attachDebugger ? "n" : "y" );
70 extras += ",address=" + debugPort;
71 extras += ",suspend=" + ( debugSuspend ? "y" : "n" );
72 return extras;
73 }
74
75
76 @Override
77 public void doExecute()
78 throws MojoExecutionException, MojoFailureException
79 {
80 if ( debugSuspend )
81 {
82 getLog().info( "starting debugger on port " + debugPort + " in suspend mode" );
83 }
84 else
85 {
86 getLog().info( "starting debugger on port " + debugPort );
87 }
88
89 super.doExecute( );
90 }
91 }