Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Background

So far, I've really enjoyed using SmartGWT with the server framework.  But with no official support from Isomorphic, getting my projects setup for Maven has to this point taken far more time than I would have liked.  Until such time as builds other than the LGPL version are available on the SmartGWT maven repository (if all you need is LGPL, then you can find that here), I guess we're on our own.

I'd been able to find other attempts at 'mavenizing' the SmartGWT builds, but in short, none of them quite worked for me.  For completeness, I'm specifically referring to

Mavenizing SmartGWT and the nightly builds

and

Mavenization of a SmartGWT EE project

In the end, I spent considerable time building my own solution using Maven itself.  It didn't turn out at all like I thought it would when I started, but it does seem to work the way I'd planned:  The result is that I can download and install (or deploy to my corporate nexus repo) any available build (nightly or release) with a command like the followingCurrently Isomorphic does not have a Maven repository for Pro+ editions of SmartGWT.  However, this article provides a downloadable Maven configuration that will:

1. download a release or nightly build of a given version and edition of SmartGWT from SmartClient.com, using your SmartClient.com developer account

2. organize the resources in the build into the expected Maven structure, with appropriate POM files declaring dependencies from SmartGWT .jars to third-party libraries

3. deploy the resulting Maven artifacts into a corporate Maven repo or install them into a developer's individual Maven cache on their machine.

An example of doing this is:

Code Block
mvn clean install -Dversion=2.5 -Dedition=eval -Dbuild=release -Disc.username=MY_USERNAME -Disc.password=MY_PASSWORD

Setup

Do yourself a favor and First set up a Maven .settings profile with property values applicable to your environment.  I have a   The following example shows a 3.0 nightly build of Power Edition license with both messaging the Messaging and analytics Analytics optional modules , so mine looks something likepurchased:

Code Block
...
<servers>
  <server>
    <id>NEXUS_ID</id>
    <username>MY_NEXUS_USERNAME</username>
    <password>MY_NEXUS_PASSWORD</password>
  </server>
</servers>


<profile>
  <id>smartgwt</id>
  <properties>
    <version>3.0</version>
    <edition>power</edition>
    <build>nightly</build>
    <messaging>true</messaging>
    <analytics>true</analytics>
    <isc.username>MY_ISOMORPHIC_ACCOUNT_USERNAME</isc.username>
    <isc.password>MY_ISOMORPHIC_ACCOUNT_PASSWORD</isc.password>
    <repo.id>NEXUS_ID</repo.id>
    <repo.url>http://myrepohostname/content/repositories/thirdparty/</repo.url>
  </properties>
</profile>

Eliminate the messaging <messaging> and analytics properties <analytics> elements if you dondidn't need purchase those modules.  Eliminate the server and repo  

The <repo*> elements are for deploying to an internal, organization-specific Maven repo.  Remove these properties if you don't intend to deploy to your own maven repository (you really should though IMO).  

Usage

Download have an internal Maven repo.

Usage

You can override these settings on the command line.  For example, this would download and deploy the 2.5 Power Edition release build instead of the 3.0 nightly build to my corporate nexus repo by overriding some of my settings from the command lineas shown in the .settings file above, then deploy it to the central corporate repo (if you have one):

Code Block
mvn clean deploy -Psmartgwt -Dversion=2.5 -Dbuild=release

Install the latest This would install the 2011-12-02 nightly of 3.0 nightly build on my workstation (i.e., my local maven cache) for evaluation in my private workspace (e.g., when I want to check whether or not some bug has been resolved) before I deploy to nexus:

Code Block
mvn clean install -Psmartgwt -Ddate=2011-12-02

Deploy the 3.0 - 2011-12-02 build when I'm happy with it.  We to the central corporate Maven repo once it's been verified.  Since "clean" isn't specified as a goal, this won't download the main (big) bundle again if we already have one locally, so I can skip the clean goal if I want and things will go considerably fasterpackage from SmartClient.com again since it was already installed locally:

Code Block
mvn deploy -Psmartgwt -Ddate=2011-12-02

Notes

One of the cool things about Maven is that the POMs sort of The POMs in the downloadable Maven configuration speak for themselves, but I'll to point out a few things:

  1. The POMs at each project's root are used for the mavenization itselfto mavenize the resources from the package downloaded from SmartClient.com.  Unless you're interested in how that works (and trust me, you shouldn't be), the POM you care about is at src/main/resources.
  2. I did the best I could with dependencies, which The dependencies are based on what you'd find in the client docs.  It wouldn't surprise me at all to hear that they still have problems, so speak up if you find something wrong with them.It's also worth mentioning that I took some liberties with packaging.  I think it makes pretty good sense, but could no doubt be made to see the error of my ways.  Again, speak up with a the SmartGWT docs.  If any of the dependencies are wrong, or you have suggestions for improvements to the setup, please comment here or on thisforum post.

Project POM Example

Again, take Adding the following dependencies to your project POM would enable the basic server functionality plus SQL support, as well as make additional skins available.   Take a look at the resulting artifacts in the  to decide what you need for your own project.  For reference, I have a project that declares SmartGWT dependencies like so:    

Code Block
<dependency>
  <groupId>com.isomorphic</groupId>
  <artifactId>smartgwt-power</artifactId>
  <version>${smartgwt.version}</version>
</dependency>
<dependency>
  <groupId>com.isomorphic</groupId>
  <artifactId>isomorphic-network</artifactId>
  <version>${smartgwt.version}</version>
</dependency>
<dependency>
  <groupId>com.isomorphic</groupId>
  <artifactId>isomorphic-sql</artifactId>
  <version>${smartgwt.version}</version>
</dependency>
<dependency>
  <groupId>com.isomorphic</groupId>
  <artifactId>smartgwt-skins</artifactId>
  <version>${smartgwt.version}</version>
</dependency>

Background

Other forum threads about different ways of setting up Maven with SmartGWT Pro/EE.  These are for reference only, as the method described in this article is better and more complete.

Mavenizing SmartGWT and the nightly builds

and

Mavenization of a SmartGWT EE project