I think that some people in this community are interested by a GWT/Sling
integration. There is an example in the Sling source but there are some
lacks in term of integration and RAD dev. My main goal is to provide a good
dev environment to build quickly gwt applications for Sling and to avoid
manual configuration. I don't want to  build a bundle package to just test
my gwt application. During my dev phase, I want to run it from eclipse or
from a mvn command line.
So, here some information on that topic :
It is possible to run in hosted mode a GWT application within Sling with the
option "noserver". You have to follow the instructions described in [1].
I'm using the maven gwt plugin [2] and it works fine on my machine. You have
to setup the "noserver" mode in the pom.xml (see below a pom.xml sample
file).
I have to clean up the pom but the current file will give you some ideas on
how to configure a new gwt application for Sling.
Until now, there is only one issue when running Gwt in hosted mode with
Sling. Indeed, following the document [1], you have to setup a new sling
folder that will contains the minim gwt application files. Rigth now, I'm
doing it manually but it could be done with a new mojo in the Sling maven
plugin. Are you agree if I'm creating a new mojo for the gwt/sling
integration ?

My work is not yet finished but if there are some interests, I can create a
new jira issue for this gwt integration and modify the current gwt demo.

br,
Christophe


[1]
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=FAQ_HostedModeNoServer
,
    http://www.screaming-penguin.com/node/4500
[2] http://gwt-maven.blogspot.com/



Pom.xml with maven gwt plugin.
-----------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>


 <modelVersion>4.0.0</modelVersion>

<groupId>org.apache.sling.browser</groupId>

<artifactId>org.apache.sling.browser</artifactId>

    <version>2.0.0-incubator-SNAPSHOT</version>

    <packaging>bundle</packaging>

<name>Apache Sling Browser</name>

<description>

        This bundle provides the Sling browser.

You can read more details on
http://cwiki.apache.org/SLING/sling-based-jcr-explorer.html

This is still a prototype.

    </description>


 <!-- TODO : update the good location for scm -->

    <!--scm>

        <connection>scm:svn:
http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/extensions/gwt/sample
</connection>

        <developerConnection>scm:svn:
https://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/extensions/gwt/sample
</developerConnection>

        <url>
http://svn.apache.org/viewvc/incubator/sling/trunk/contrib/extensions/gwt/sample
</url>

    </scm -->


 <!--  convenience to define GWT version in one place -->

<properties>

<gwtVersion>1.5.3</gwtVersion>

<devServer>http://localhost:8080</devServer>

</properties>


 <dependencies>

<!--  GWT deps (from central repo) -->

<dependency>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-servlet</artifactId>

<version>${gwtVersion}</version>

<scope>runtime</scope>

</dependency>

<dependency>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-user</artifactId>

<version>${gwtVersion}</version>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-dev</artifactId>

<version>${gwtVersion}</version>

<classifier>${platform}-libs</classifier>

<type>zip</type>

<scope>provided</scope>

</dependency>

<dependency>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-dev</artifactId>

<version>${gwtVersion}</version>

<classifier>${platform}</classifier>

<scope>provided</scope>

</dependency>

         <dependency>

            <groupId>log4j</groupId>

            <artifactId>log4j</artifactId>

            <version>1.2.14</version>

        </dependency>

 <dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.1</version>

<scope>test</scope>

</dependency>

</dependencies>


 <build>

<plugins>

            <!-- Apache Felix SCR Plugin: automatically extracts
SCR-descriptors

                from the source and generates the required bundle metadata
-->

            <plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-scr-plugin</artifactId>

            </plugin>

            <plugin>

                <groupId>org.apache.felix</groupId>

                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>

                <configuration>

                    <instructions>

                        <Export-Package>

                            org.apache.sling.browser.*

                        </Export-Package>

                        <DynamicImport-Package>

                            com.google.gwt.*

                        </DynamicImport-Package>

                        <Sling-Initial-Content>

                            SLING-INF/content

                        </Sling-Initial-Content>

                        <Sling-Bundle-Resources>

                            /gwt

                        </Sling-Bundle-Resources>

                        <Include-Resource>

                            gwt=target/gwt,{maven-resources}

                        </Include-Resource>

                    </instructions>

                </configuration>

            </plugin>




 <!--  configure the GWT-Maven plugin -->

<plugin>

<groupId>com.totsp.gwt</groupId>

<artifactId>maven-googlewebtoolkit2-plugin</artifactId>

<version>2.0-beta26</version>

<configuration>

 <noServer>true</noServer>

<logLevel>INFO</logLevel>

<compileTargets>

<value>org.apache.sling.browser.JcrBrowserApplication</value>

</compileTargets>

<runTarget>
${devServer}/org.apache.sling.browser.JcrBrowserApplication/JcrBrowserApplication.html
</runTarget>

<style>DETAILED</style>

 <extraJvmArgs>-Xmx512m</extraJvmArgs>

<i18nConstantsWithLookup>false</i18nConstantsWithLookup>

<!-- i18nConstantsNames>

<value>org.apache.sling.browser.client.AppConstants</value>

</i18nConstantsNames>

<i18nMessagesNames>

<value>org.apache.sling.browser.AppMessages</value>

</i18nMessagesNames -->


 <gwtVersion>${gwtVersion}</gwtVersion>

</configuration>

<executions>

<execution>

<goals>

<!-- goal>i18n</goal -->

<goal>compile</goal>

<goal>test</goal>

</goals>

</execution>

</executions>

</plugin>

<!--  Use the dependency plugin to unpack gwt-dev-PLATFORM-libs.zip -->

<!--

(this is a replacement for the old "automatic" mode - useful if you

don't have GWT installed already, or you just want a maven way to

handle gwt deps)

-->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-dependency-plugin</artifactId>

<executions>

<execution>

<id>unpack</id>

<phase>compile</phase>

<goals>

<goal>unpack</goal>

</goals>

<configuration>

<artifactItems>

<artifactItem>

<groupId>com.google.gwt</groupId>

<artifactId>gwt-dev</artifactId>

<version>${gwtVersion}</version>

<classifier>${platform}-libs</classifier>

<type>zip</type>

<overWrite>false</overWrite>

<outputDirectory>
${settings.localRepository}/com/google/gwt/gwt-dev/${gwtVersion}</
outputDirectory>

</artifactItem>

</artifactItems>

</configuration>

</execution>

</executions>

</plugin>

<!--

If you want to use the target/web.xml file mergewebxml produces,

tell the war plugin to use it.

Also, exclude what you want from the final artifact here.

-->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<configuration>

<webXml>target/web.xml</webXml>

                    <warSourceExcludes>.gwt-tmp/**</warSourceExcludes>

</configuration>

</plugin>

<!--  tell the compiler we can use 1.5 -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<configuration>

<source>1.5</source>

<target>1.5</target>

</configuration>

</plugin>

</plugins>

</build>


 <!--  include pluginRepository and repository for GWT-Maven -->

<pluginRepositories>

<pluginRepository>

<id>gwt-maven-plugins</id>

<url>

                http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/

            </url>

</pluginRepository>

</pluginRepositories>

<repositories>

<repository>

<id>gwt-maven</id>

<url>

                http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/

            </url>

</repository>

</repositories>



 <!--  profiles (with activation per platform) -->

<profiles>

<profile>

<id>gwt-dev-windows</id>

<properties>

<platform>windows</platform>

</properties>

<activation>

<activeByDefault>false</activeByDefault>

<os>

<family>windows</family>

</os>

</activation>

</profile>

<profile>

<id>gwt-dev-mac</id>

<properties>

<platform>mac</platform>

</properties>

<activation>

<activeByDefault>true</activeByDefault>

<os>

<family>mac</family>

</os>

</activation>

</profile>

<profile>

<id>gwt-dev-linux</id>

<properties>

<platform>linux</platform>

</properties>

<activation>

<activeByDefault>false</activeByDefault>

<os>

<name>linux</name>

</os>

</activation>

</profile>

</profiles>

</project>

Reply via email to