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 following:

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 set up a .settings profile with property values applicable to your environment.  I have a Power Edition license with both messaging and analytics optional modules, so mine looks something like:

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 and analytics properties if you don't need those modules.  Eliminate the server and repo properties if you don't intend to deploy to your own maven repository (you really should though IMO).  

Usage

Download and deploy the 2.5 Power Edition release build to my corporate nexus repo by overriding some of my settings from the command line:

Code Block

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

Install the latest 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 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 faster

Code Block

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

Notes

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

  1. The POMs at each project's root are used for the mavenization itself.  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 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.
  3. 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 comment here or on this forum post.

Example

Again, take a look at the resulting artifacts to decide what you need for your own project.  For reference, I have a project that declares SmartGWT dependencies like so:    

...

Each nightly build includes the POMs that outline each module's dependencies. These files can be used to install either SmartClient or SmartGWT artifacts to your own Maven repositories, where they can be referenced like any other Maven artifact.  

 

Example:

 

<dependencies>
<dependency>
<groupId>com.isomorphic.smartclient.lgpl</groupId>
<artifactId>smartclient-lgpl</artifactId>
<version>11.0-p20160829</version>
</dependency>
</dependencies>
or
<dependencies>
  <dependency>
    <groupId>com.isomorphic.smartgwt.lgpl</groupId>
    <artifactId>smartgwt-lgpl</artifactId>
    <version>6.0-p20160829</version>
  </dependency>
</dependencies>

 

The plugin is deployed to Maven Central, so minimal configuration is required. Refer to the documentation at http://github.smartclient.com/isc-maven-plugin/ for more detaied documentation, but the simplest possible invocation for an LGPL build might look something like

 
mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=LGPL -DbuildNumber=6.0p
or
mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTCLIENT -Dlicense=LGPL -DbuildNumber=11.0p

 

which will cause Maven to install the plugin (if necessary) and cause the plugin to download and install the relevant artifacts for the LGPL version onto your local Maven repository. The process is the same for Pro editions and higher, just provide your Developer Login on the command line:

 

mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTCLIENT -Dlicense=POWER -DbuildNumber=11.0p -Dusername=[YOUR_USERNAME] -Dpassword=[YOUR_PASSWORD]

or

mvn com.isomorphic:isc-maven-plugin:install -Dproduct=SMARTGWT -Dlicense=POWER -DbuildNumber=6.0p -Dusername=[YOUR_USERNAME] -Dpassword=[YOUR_PASSWORD]


As always, please feel free to add your own examples here on the wiki or post questions about usage, etc. to the forums.