Mavenization of a SmartGWT EE project

We prefer the Google Web Toolkit (GWT) for creating rich intranet applications mainly for it’s flexibility, fast development and availability of component frameworks. We also use Maven to build our Java projects. The combination of both frameworks works pretty good as Google provides all required artifacts via public repositories.

In the last weeks we were evaluating the SmartGWT Enterprise Edition. The enterprise edition adds a lot of server side features. For example a possibility to declare a data source, easier integration to server technologies like Hibernate, EJB or Spring and many more. I don’t want to describe here all features of the enterprise version, but I want to describe something else. The package of SmartGWT EE contains in a one big package everything what is necessary so start developing, but unfortunately for us there is no support for Maven build projects. All isomorphic* libraries including third party dependencies are in one lib directory and are used by all samples referenced from Ant build scripts.

In my opinion using Maven and a company’s repository is the most convenient way for a developer to start working. So I decided to „mavenize“ the provided libraries and create the Maven archetype. The archetype is a small application using GWT and SmartGWT UI part rendering a grid with a list of entities. It supports adding a new record, updating or deleting an existing one. The server side is managed by a Spring managed bean called from the preconfigured Isomorphic data source. The persistence layer is developed using JPA2 (Hibernate implementation). The used database is by default the in-memory HyperSQL. The project is deployed by default into the Jetty web server and allows to simply run the application in a GWT Development mode.

SmartGWT EE Maven Archetype

In order to be able to reference Isomorphic libraries I had to prepare a maven configuration for all artifacts and define all dependencies. So I did that based on the available documentation and by analysing the actual requirements. And based on that I have prepared a Maven configuration for the following libraries

  • isomorphic_assembly
  • isomorphic_compression
  • isomorphic_core_rpc
  • isomorphic_hibernate
  • isomorphic_spring
  • isomorphic_sql
  • smartgwtee

So I have installed all these dependencies contained in the SmartGWT Enterprise Edition evaluation package plus a parent module into our public repository.

http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/

We did not change the content of any of mentioned jar libraries. We have installed the libraries from the evaluation package into our public Maven repository using a process described in this article. We are not responsible for the content of these libraries. The evaluation edition may be only used for 60 days without acquiring either a license or special permission from Isomorphic. For any questions concerning pricing or licensing refer directly to SmartClient.

Now you can start evaluating your own SmartGWT EE based application very fast. The only requirement is to have installed a Java virtual machine and Maven.

To generate your own project based on our archetype open the console, go to the directory where you want to create the project and use the following command

mvn archetype:generate -DarchetypeArtifactId=bytesource-smartgwtee-archetype -DarchetypeVersion=1.0.0 -DarchetypeRepository=http://nexus.bytesource.net/nexus/content/repositories/maven2/ -DgroupId=com.mycompany -DartifactId=bytesource-gwt-project -Dversion=1.0-SNAPSHOT

If everything went through then the directory contains a new subdirectory bytesource-gwt-project. To run the generated application use

cd bytesource-gwt-project
mvn package jetty:run

the second command downloads all required dependencies into your local Maven repository (by default in the $HOME/.m2/repository), builds the whole application and starts the application within the Jetty web server. The running application will be available on http://localhost:8080/bytesource-gwt-project/

To run the application in a GWT Development mode just use the following command in the project directory

mvn package gwt:run

To create the importable Eclipse project use

mvn eclipse:eclipse

Libraries installed locally

All libraries can be installed to the user’s local Maven repository or eg. to remote company’s Maven repository. Also for that purpose our Maven configurations can be used. I will describe the installation to the user’s local Maven repository. The installation to the remote repository can be very similar to the local one. All pom.xml files need to contain the <distributionManagement> section defining where artifacts are deployed or the repository administrator can deploy everything via an interactive UI.

The following steps describe the installation of all dependencies required to develop a SmartGWT application using the EE features (for example our archetype). The lib directory in the following text references the unpacked subdirectory in the SmartGWT package.

All pom files downloaded from our site contain a section <repository/> referring the ByteSource public Maven repository. If you plan to use only a local or your own central repository then remove our repository or replace it by your own one BEFORE you install the pom.

  • smartgwtee.jar
    mvn install:install-file -DgroupId=com.smartgwtee -DartifactId=smartgwtee -Dversion=2.4 -Dpackaging=jar -Dfile=lib/smartgwtee.jar
  • isc-jakarta-oro.jar
    mvn install:install-file -DgroupId=isc.org.apache -DartifactId=isc-jakarta-oro -Dversion=2.0.6 -Dpackaging=jar -DcreateChecksum=true -Dfile=lib/isc-jakarta-oro-2.0.6.jar
  • isomorphic-parent
    • download the parent pom file and save it in a working directory. Here is an example how I do it on my Linux system with the following command. Any web browser can be used as well.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic-parent/1/isomorphic-parent-1.pom
    • install the parent into the local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic-parent -Dversion=1 -Dpackaging=pom -DcreateChecksum=true -DpomFile=isomorphic-parent-1.pom -Dfile=isomorphic-parent-1.pom
  • isomorphic_core_rpc
    • download isomorphic.core-rpc-2.4.pom file and save it in a working directory.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic.core-rpc/2.4/isomorphic.core-rpc-2.4.pom
    • install the library from the SmartGWT package into a local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic.core-rpc -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true -DpomFile=isomorphic.core-rpc-2.4.pom -Dfile=lib/isomorphic_core_rpc.jar
  • isomorphic_assembly
    • download isomorphic.assembly-2.4.pom file and save it in a working directory.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic.assembly/2.4/isomorphic.assembly-2.4.pom
    • install the library from the SmartGWT package into the local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic.assembly -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true -DpomFile=isomorphic.assembly-2.4.pom -Dfile=lib/isomorphic_assembly.jar
  • isomorphic_compression
    • download isomorphic.compression-2.4.pom file and save it in a working directory.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic.compression/2.4/isomorphic.compression-2.4.pom
    • install the library from the SmartGWT package into the local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic.compression -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true -DpomFile=isomorphic.compression-2.4.pom -Dfile=lib/isomorphic_compression.jar
  • isomorphic_spring
    • download isomorphic.spring-2.4.pom file and save it in a working directory.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic.spring/2.4/isomorphic.spring-2.4.pom
    • install the library from the SmartGWT package into the local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic.spring -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true -DpomFile=isomorphic.spring-2.4.pom -Dfile=lib/isomorphic_spring.jar
  • isomorphic_sql
    • download isomorphic.sql-2.4.pom file and save it in a working directory.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic.sql/2.4/isomorphic.sql-2.4.pom
    • install the library from the SmartGWT package into the local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic.sql -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true -DpomFile=isomorphic.sql-2.4.pom -Dfile=lib/isomorphic_sql.jar
  • isomorphic_hibernate
    • download isomorphic.hibernate-2.4.pom file and save it in a working directory.
      wget http://nexus.bytesource.net/nexus/content/repositories/maven2/com/isomorphic/isomorphic.hibernate/2.4/isomorphic.hibernate-2.4.pom
    • install the library from the SmartGWT package into the local Maven repository
      mvn install:install-file -DgroupId=com.isomorphic -DartifactId=isomorphic.hibernate -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true -DpomFile=isomorphic.hibernate-2.4.pom -Dfile=lib/isomorphic_hibernate.jar

The SmartGWT EE libraries are now installed into the local Maven repository and you can define them in your project’s pom.xml as dependency. For example a dependency on isomorphic.core-rpc looks like this:

<dependency>
    <groupId>com.isomorphic</groupId>
    <artifactId>isomorphic.core-rpc</artifactId>
    <version>2.4</version>
</dependency>

All third party dependencies of core-rpc are defined in the artefact’s pom.xml and will be downloaded automatically. For additional details look on our archetype described in previous chapter.

I did not really check fully the hibernate and sql usage as I don’t see a real usage for it in this example. I concentrated mostly on the Spring integration so it could happen that there is some dependency of a hibernate or sql package which I missed. If you find some problem, then please let me know and I will hopefully find time to fix it.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*
*

4 × vier =