PageRenderTime 55ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/src/site/apt/user-guide/compile.apt.vm

https://github.com/ligangty/gwt-maven-plugin
Velocity Template Language | 149 lines | 123 code | 26 blank | 0 comment | 0 complexity | 62acd20f87c9b3fcf737428e5e0f1eb7 MD5 | raw file
Possible License(s): Apache-2.0
  1. ------
  2. GWT Maven Plugin Usage
  3. ------
  4. Nicoles de Loof
  5. ------
  6. 2010-11-19
  7. ~~ Licensed to the Apache Software Foundation (ASF) under one
  8. ~~ or more contributor license agreements. See the NOTICE file
  9. ~~ distributed with this work for additional information
  10. ~~ regarding copyright ownership. The ASF licenses this file
  11. ~~ to you under the Apache License, Version 2.0 (the
  12. ~~ "License"); you may not use this file except in compliance
  13. ~~ with the License. You may obtain a copy of the License at
  14. ~~
  15. ~~ http://www.apache.org/licenses/LICENSE-2.0
  16. ~~
  17. ~~ Unless required by applicable law or agreed to in writing,
  18. ~~ software distributed under the License is distributed on an
  19. ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  20. ~~ KIND, either express or implied. See the License for the
  21. ~~ specific language governing permissions and limitations
  22. ~~ under the License.
  23. ~~ NOTE: For help with the syntax of this file, see:
  24. ~~ http://maven.apache.org/doxia/references/apt-format.html
  25. Compile GWT application
  26. You can use the following configuration in your pom.xml to run the GWT compiler
  27. when the project is built. By default, the {{{../compile-mojo.html}compile}} goal is configured
  28. to be executed during the ''prepare-package'' phase to run as late as possible.
  29. +--
  30. <project>
  31. [...]
  32. <build>
  33. <plugins>
  34. [...]
  35. <plugin>
  36. <groupId>org.codehaus.mojo</groupId>
  37. <artifactId>gwt-maven-plugin</artifactId>
  38. <version>${project.version}</version>
  39. <executions>
  40. <execution>
  41. <configuration>
  42. <module>com.mycompany.gwt.Module</module>
  43. </configuration>
  44. <goals>
  45. <goal>compile</goal>
  46. </goals>
  47. </execution>
  48. </executions>
  49. </plugin>
  50. [...]
  51. </plugins>
  52. </build>
  53. [...]
  54. </project>
  55. +--
  56. * Configure GWT modules
  57. The <<<module>>> paramter can be used to define a single module in your application. You can also configure
  58. compilation for multiple modules by nesting them inside a ''<modules>'' element. If none is
  59. set, the plugin will automagically scan project source and resources directories for ''.gwt.xml'' module files.
  60. You can also force the plugin to compile a module from command line by setting the <<<gwt.module>>> system property.
  61. * Tweak the compiler output
  62. By default, the GWT compiler is run with WARN logging. If you have compilation issues, you may want it to
  63. be more verbose. Simply add a command line option :
  64. +---+
  65. -Dgwt.logLevel=[LOGLEVEL]
  66. +---+
  67. Where LOGLEVEL can be ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
  68. The compiler style is set to its default value (<<<OBFUSCATED>>>) to generate compact javascript. You can override this
  69. for debugging purpose of the generated javascript by running with command line option :
  70. +---+
  71. -Dgwt.style=[PRETTY|DETAILED]
  72. +---+
  73. The compiler will output the generated javascript in the project output folder (<<<$\{project.build.directory\}/$\{project.build.finalName\}>>>).
  74. For a WAR project, this matches the exploded web application root. You can also configure the plugin to compile in
  75. <<<$\{basedir\}/src/main/webapp>>> that may better match using lightweight development process based on
  76. to the {{{http://maven.apache.org/plugins/maven-war-plugin/inplace-mojo.html}"inplace"}} mode of the war plugin. To enable
  77. this, just set the <<<inplace>>> parameter to true.
  78. * Compilation process failing
  79. You may get compilation errors due to <<<OutOfMemoryException>>> or <<<StackOverflowException>>>. The compilation and
  80. permutation process used by GWTCompiler is a high memory consumer, with many recursive steps. You can get rid of those
  81. errors by setting the JVM parameters used to create the child process where GWT compilation occurs :
  82. +--
  83. <project>
  84. [...]
  85. <build>
  86. <plugins>
  87. [...]
  88. <plugin>
  89. <groupId>org.codehaus.mojo</groupId>
  90. <artifactId>gwt-maven-plugin</artifactId>
  91. <version>${project.version}</version>
  92. <executions>
  93. <execution>
  94. <configuration>
  95. <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
  96. </configuration>
  97. <goals>
  98. <goal>compile</goal>
  99. </goals>
  100. </execution>
  101. </executions>
  102. </plugin>
  103. [...]
  104. </plugins>
  105. </build>
  106. [...]
  107. </project>
  108. +--
  109. * Compiler output directory
  110. The compile goal is used to run the GWTCompiler and generate the JavaScript application. This mojo can switch
  111. beetween to modes : <standard> or <inplace>.
  112. <<Standard>> uses simple integration of GWTCompiler in the maven build process and will output in the project build
  113. directory where the maven-war-plugin is expected to create the exploded web-application before packaging it as a WAR.
  114. <<Inplace>> use the web application source directory <<<src/main/webapp>>> as output folder.
  115. to match the {{{http://maven.apache.org/plugins/maven-war-plugin/inplace-mojo.html}war:inplace}} goal. This one
  116. setup an explosed WAR structure in the source folder for rapid JEE development without the time-consuming
  117. package/deploy/restart cycle.
  118. Using this folder is also very usefull for those of us that run a server using
  119. {{{http://tomcat.apache.org/maven-plugin-2/run-mojo-features.html}tomcat7:run}} or
  120. {{{http://jetty.mortbay.org/jetty/maven-plugin/run-mojo.html}jetty:run}} goals. Those plugins don't require any packaging
  121. to launch the webapp, and handle nicely Maven dependencies and classes without requirement for a <<<WEB-INF/lib>>> and
  122. <<<WEB-INF/classes>>>. With this default GWTCompiler output directory, the application can be run as is with no packaging
  123. requirement.