When you tell the DevMode plugin, via
-war target/webapp-war folder,
it has a check in the code, to ensure that any servlets etc, mentioned in
modules, are found in the web.xml.
The method is at the end of com.google.gwt.dev.DevMode class
What it is depending on is the Servlet entries in your gwt.xml files. Now it
just so happened, I THINK I might have the way around that. My modules won't
have any servlet tags in them. Essentially, using spring, and the
GwtDispatcher, I don't have servlet entries. So hopefully, this check will
be bypassed.
Will keep you posted. (*I have started a separate set of classes .. -
MavenCompatibleDevMode - but may not need them).
*The src/main/webapp folder will just need the .nocache.js files for each
Module, in place. This of course can be compiled from maven (command line)
or copied from the target.. into src/main/webapp so the app can launch in
dev mode, through the plugin.
*
Below is the check for servlet tags.
*
private void validateServletTags(TreeLogger logger,
ServletValidator servletValidator, ModuleDef module, File webXml) {
TreeLogger servletLogger = logger.branch(TreeLogger.DEBUG,
"Validating <servlet> tags for module '" + module.getName() + "'",
null, new InstalledHelpInfo("servletMappings.html"));
String[] servletPaths = module.getServletPaths();
if (servletValidator == null && servletPaths.length > 0) {
servletLogger.log(
TreeLogger.WARN,
"Module declares "
+ servletPaths.length
+ " <servlet> declaration(s), but a valid 'web.xml' was not
found at '"
+ webXml.getAbsolutePath() + "'");
} else {
for (String servletPath : servletPaths) {
String servletClass = module.findServletForPath(servletPath);
assert (servletClass != null);
// Prefix module name to convert module mapping to global mapping.
servletPath = "/" + module.getName() + servletPath;
servletValidator.validate(servletLogger, servletClass, servletPath);
}
}
}
On Mon, Apr 26, 2010 at 2:13 PM, Joseph Ottinger <[email protected]>wrote:
> You can't use the target directories for the JS?
>
>
> On Sat, Apr 24, 2010 at 10:50 AM, Ramon Buckland <[email protected]>wrote:
>
>> Hi Steve,
>>
>> I think I have what you are after.
>>
>> What does this pom.xml do ?
>>
>> a. mvn package - Creates the war, compiles the java source code.
>> b. mvn jetty:run - compiles the GWT to JS into the target/war
>> directory and launches jetty (with a debug profile, you can start
>> eclipse debugger onto it)
>> c. with a launch configuration, Run GWT2 DevMode and run the GWT Jetty
>> in eclipse, with the Browser plugin of your choice as google has
>> intended it.
>> d. a separate launch configuration, (not yet polished) that starts
>> the DevMode as -noserver, Combine this with (b) and you have Maven
>> running jetty and Eclipse running te debugger.. and you can debug the
>> two separate instances.
>>
>> What I have NOT yet worked out. the GWT DevMode compiles the GWT
>> classes to JS, and lays the into my src/main/webapp folder. I don't
>> like this as my Project is under source control, and the JS is a
>> compile artefact, not something I want to checkin.
>> The compilation of the JS and placing in the src/main/webapp is a
>> design of the DevMode, kind of required because jetty needs to serve
>> out the JS files.
>> .. other attempts to change it, short of making a new DevMode
>> ServletContainer (am working on this) prove fruitless.
>>
>> Here is what you will want.
>>
>> -=============== Snippets from pom.xml ==================-
>>
>> ....
>> <properties>
>> <version-gwt>2.0.3</version-gwt>
>> </properties>
>>
>> ....
>> <dependencies>
>>
>> <dependency>
>> <groupId>com.google.gwt</groupId>
>> <artifactId>gwt-user</artifactId>
>> <version>${version-gwt}</version>
>> <scope>provided</scope>
>> </dependency>
>>
>> <dependency>
>> <groupId>com.google.gwt</groupId>
>> <artifactId>gwt-dev</artifactId>
>> <version>${version-gwt}</version>
>> <scope>test</scope>
>> </dependency>
>>
>> <dependency>
>> <groupId>com.google.gwt</groupId>
>> <artifactId>gwt-servlet</artifactId>
>> <version>${version-gwt}</version>
>> <scope>runtime</scope>
>> </dependency>
>>
>> </dependencies>
>> <build>
>> <plugins>
>>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-compiler-plugin</artifactId>
>> <configuration>
>> <source>1.6</source>
>> <target>1.6</target>
>> </configuration>
>> </plugin>
>>
>> <plugin>
>> <groupId>org.mortbay.jetty</groupId>
>> <artifactId>maven-jetty-plugin</artifactId>
>> <version>6.1.16</version>
>> <configuration>
>> <webAppConfig>
>> <contextPath>/</contextPath>
>> <baseResource
>> implementation="org.mortbay.resource.ResourceCollection">
>> <!-- this magic helps us have static resources in src/
>> main/webapp, and with the gwt-maven-plugin, the GWT Compile JS in
>> target/ -->
>> <resources>src/main/webapp,target/sample-gwt-webapp</
>> resources>
>> </baseResource>
>> </webAppConfig>
>> <connectors>
>> <connector
>> implementation="org.mortbay.jetty.nio.SelectChannelConnector">
>> <port>9977</port>
>> <maxIdleTime>60000</maxIdleTime>
>> </connector>
>> </connectors>
>> </configuration>
>> </plugin>
>> <plugin>
>> <groupId>org.codehaus.mojo</groupId>
>> <artifactId>gwt-maven-plugin</artifactId>
>> <!-- version>1.1</version -->
>> <configuration>
>> <hostedWebapp>${project.build.directory}/$
>> {project.artifactId}</hostedWebapp>
>> <module>org.mygwt.gwtsample.ui.SampleStackPanel</module>
>> </configuration>
>> <executions>
>> <execution>
>> <id>compile-gwt</id>
>> <phase>compile</phase>
>> <goals>
>> <goal>compile</goal>
>> </goals>
>> </execution>
>> <execution>
>> <id>generate-async-gwt</id>
>> <phase>generate-sources</phase>
>> <goals>
>> <goal>generateAsync</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>> <plugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-eclipse-plugin</artifactId>
>> <version>2.8</version>
>> <configuration>
>> <additionalBuildcommands>
>> <buildCommand>
>>
>> <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
>> </buildCommand>
>> <buildCommand>
>> <name>com.google.gwt.eclipse.core.gwtProjectValidator</
>> name>
>> </buildCommand>
>> </additionalBuildcommands>
>> <classpathContainers>
>>
>> <classpathContainer>com.google.gwt.eclipse.core.GWT_CONTAINER</
>> classpathContainer>
>>
>> <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</
>> classpathContainer>
>> </classpathContainers>
>> <!-- we need to exclude the dev and user libs from maven
>> eclipse
>> adding them to the .classpath
>> as 1. they are already provided by
>> com.google.gwt.eclipse.core.GWT_CONTAINER
>> 2. the GWT Plugin complains that it cannot
>> find a GWT SDK, if
>> these two are in there
>> I found, if I moved the GWT SDK
>> Container (properties in
>> eclipse, move build path dep) up the tree
>> above these two jars, the problem
>> went away.. so .. just
>> removing them works, as you don't have
>> control over the order of deps in
>> the .classpath, by the maven-
>> eclipse-plugin
>> we need these two jars in our pom, for the
>> gwt-maven-plugin (which
>> compiles our final GWT classes)
>> -->
>> <excludes>
>> <exclude>com.google.gwt:gwt-dev</exclude>
>> <exclude>com.google.gwt:gwt-user</exclude>
>> </excludes>
>> <additionalProjectnatures>
>> <projectnature>org.eclipse.jdt.core.javanature</
>> projectnature>
>>
>> <projectnature>org.springframework.ide.eclipse.core.springnature</
>> projectnature>
>> <projectnature>com.google.gwt.eclipse.core.gwtNature</
>> projectnature>
>> </additionalProjectnatures>
>> </configuration>
>> </plugin>
>> </plugins>
>> <!--
>> by default the project id and version are the
>> final name, we don't
>> want the version And this matches the GWT
>> plugins job of compiling to
>> the same hostedWebApp folder (above)
>> -->
>> <finalName>${project.artifactId}</finalName>
>> </build>
>>
>> -=============== launch configuration files in src/eclipse
>> ==================-
>>
>> No Server Launch - In these launch configurations - change sample-gwt-
>> webapp to your project name (there is a better eclipse variable
>> project_loc but I could not seem to get it working .. so it is kind of
>> hard coded in these launch configs.
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> <launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
>> <booleanAttribute
>> key="com.google.gdt.eclipse.core.AUTO_PORT_SELECTION" value="true"/>
>> <booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER"
>> value="false"/>
>> <stringAttribute
>>
>> key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME"
>> value="com.google.gwt.dev.GWTShell"/>
>> <booleanAttribute
>>
>> key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES"
>> value="true"/>
>> <stringAttribute key="com.google.gwt.eclipse.core.URL" value="http://
>> localhost:9977/index.jsp"/>
>> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
>> <listEntry value="/sample-gwt-webapp"/>
>> </listAttribute>
>> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
>> <listEntry value="4"/>
>> </listAttribute>
>> <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
>> <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
>> <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
>> </listAttribute>
>> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER"
>> value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
>> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
>> value="com.google.gwt.dev.DevMode"/>
>> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
>> value="-noserver -war "${workspace_loc:sample-gwt-webapp/target}/
>> eclipse-gwt-war" -startupUrl http://localhost:9977/index.jsp -
>> logLevel INFO org.mygwt.gwtsample.ui.SampleStackPanel"/>
>> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
>> value="sample-gwt-webapp"/>
>> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-
>> Xmx512m"/>
>> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY"
>> value="${workspace_loc:sample-gwt-webapp/target}"/>
>> </launchConfiguration>
>>
>>
>> --- The DevMode launcher.
>>
>>
>> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
>> <launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
>> <booleanAttribute
>> key="com.google.gdt.eclipse.core.AUTO_PORT_SELECTION" value="true"/>
>> <stringAttribute
>>
>> key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME"
>> value="com.google.gwt.dev.GWTShell"/>
>> <booleanAttribute
>>
>> key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES"
>> value="true"/>
>> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
>> <listEntry value="/sample-gwt-webapp"/>
>> </listAttribute>
>> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
>> <listEntry value="4"/>
>> </listAttribute>
>> <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
>> <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
>> <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
>> </listAttribute>
>> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER"
>> value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
>> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
>> value="com.google.gwt.dev.DevMode"/>
>> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
>> value="-logLevel INFO -war "${workspace_loc:sample-gwt-webapp/src/
>> main/webapp}" -gen "${workspace_loc:sample-gwt-webapp/target}
>> " -remoteUI "${gwt_remote_ui_server_port}:${unique_id}"
>> -logLevel INFO -port auto org.mygwt.gwtsample.ui.SampleStackPanel"/>
>> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
>> value="sample-gwt-webapp"/>
>> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-
>> Xmx512m"/>
>> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY"
>> value="${workspace_loc:sample-gwt-webapp/target}"/>
>> </launchConfiguration>
>>
>>
>> Hope that helps..
>>
>> I am working on a replacement DevMode Jetty Container which will do
>> exactly what we will need it to do for Maven. Stay tuned.
>>
>> Ramon
>> On Apr 18, 6:55 pm, Steve <[email protected]> wrote:
>> > I'm getting very frustrated -- reading dozens of messages, faqs,
>> > whatever I can find on the subject, but I haven't found all the info I
>> > need in one place and haven't been able to piece it all together ...
>> > maybe I just missed it, but hopefully someone here can help.
>> >
>> > What I'd like to do ...
>> >
>> > Create a GWT project, useMaveninstead of Ant to build. Be able to
>> > debug in DevMode, be able to "mvn package" and manually deploy my war
>> > to a container.
>> >
>> > Using Eclipse (3.5.2), m2eclipse, GPE 1.3.2 -- what do I need to do?
>> > What is the directory structure I need? Is there amavenarchetype to
>> > create the directory structure?
>> >
>> > I tried the MavenAppRpc project. I was successful in building it and
>> > deploying the war to Tomcat. However, I could never get it to work in
>> > DevMode.
>> >
>> > Is there a 1-2-3 type tutorial available that can get me started?
>> >
>> > Thanks
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Google Web Toolkit" group.
>> > To post to this group, send email to
>> [email protected].
>> > To unsubscribe from this group, send email to
>> [email protected]<google-web-toolkit%[email protected]>
>> .
>> > For more options, visit this group athttp://
>> groups.google.com/group/google-web-toolkit?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-web-toolkit%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
>
>
> --
> Joseph B. Ottinger
> http://enigmastation.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.