Maven Support
SmartGWT artifacts are not
published to any public repository, but a POM for each is included in the SDK, and can be
used to install them to your own private Maven repository. The official
Isomorphic plugin for
Maven
contains a handful of targets intended to simplify that process through automation. Please
refer to the plugin's documentation for usage and examples.
For a complete listing of artifacts installed in your environment, consult your repository
manager. Where no repository manager is in use, a directory listing of your local
repository can often provide all the detail you need. Once you've made an artifact
available to your build, you can use it just like you'd use any other dependency.
You can of course declare these dependencies in your existing project as you would any other.
Should you be working with a single-module project (as opposed to the
multi-module
format recommended by authors of both
GWT and
Eclipse
plugins), you may find that you need to take steps to remove server-side dependencies from your
client-side classpath. The older releases of the asm library, included transitively
with isomorphic-tools by way of Hibernate, has been known to cause problems for developers
working in single module projects, for example. This really is unrelated to SmartGWT itself,
so you can work around it using standard classpath manipulation techniques. In the case of
asm, this can be as simple as an exclusion on the tools dependency:
<dependency>
<groupId>com.isomorphic.smartgwt.eval</groupId>
<artifactId>isomorphic-tools</artifactId>
<version>${smartgwt.version}</version>
<exclusions>
<exclusion>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
Most users should at least consider converting existing projects to a multi-module format,
and use one of the SmartGWT archetypes for new projects. These archetypes are available
following execution of the plugin's install or deploy goals. To create a new project
based on the smartgwt-quickstart archetype:
- Install Maven, if necessary.
- Install SmartGWT, if necessary. Note that when copy/pasting commands,
you may need to substitute the backslash with the appropriate character to
escape new lines in your command-line interface
(eg:
^
for Windows command-line, `
for PowerShell, etc).
mvn com.isomorphic:isc-maven-plugin:1.4.5:install \
-Dproduct=SMARTGWT -Dlicense=EVAL -DbuildNumber=13.0p
-
Generate a project (using LATEST as below, or the version installed for you in step 2)
mvn archetype:generate \
-DartifactId=my-application \
-Dmodule=MyApplication -Dmodule-short-name=myapp \
-DgroupId=com.example -Dpackage=com.example.myapplication \
-DarchetypeGroupId=com.isomorphic.archetype \
-DarchetypeArtifactId=archetype-smartgwt-quickstart \
-DarchetypeVersion=LATEST -DinteractiveMode=false
and refer to the README in the new 'my-application' directory for further instructions
around usage in Maven, Ant, and Eclipse environments.
To generate a project from any of the following archetypes, provide its artifactId to the
above command's archetypeArtifactId parameter:
- archetype-smartgwt-quickstart:
The recommended approach for most applications, using data access / databinding with
"sql" datasources
- archetype-smartgwt-quickstart-relogin:
Like archetype-smartgwt-quickstart, but includes integration with Spring
Security to illustrate the
relogin
pattern.
- archetype-smartgwt-example-builtinds:
Illustrates how a single databound component can be used (and re-used) with many
datasources
- archetype-smartgwt-example-customds:
Illustrates setting up a DataSource accessing a servlet front controller (for example
Spring MVC controller) for the various DataSource operations
- archetype-smartgwt-example-dsdmi:
llustrates setting up a DataSource that calls methods on your configured server bean
in response to DataSource operations (fetch, add, update, remove)
- archetype-smartgwt-example-dshibernate:
llustrates the use of "hibernate" datasources in 'beanless mode'
- archetype-smartgwt-example-dshibernatederived:
This example illustrates the use of "hibernate" datasources with 'autoDeriveSchema'
to inherit fields from a Hibernate mapping or bean
- archetype-smartgwt-example-dsjpa:
llustrates the use of JPA DataSources
- archetype-smartgwt-example-gae:
llustrates an approach to running a SmartGWT application on the Google App Engine
standard environment using SQL DataSources
- archetype-smartgwt-example-gaedatastore:
llustrates an approach to running a SmartGWT application on the Google App Engine
standard environment using Google Cloud Datastore as a _limited_ JPA DataSource
- archetype-smartgwt-example-gaejpa:
llustrates an approach to running a SmartGWT application on the Google App Engine
standard environment using JPA DataSources
- archetype-smartgwt-example-manualhibernate:
llustrates setting up a DataSource that accesses your servlet controller, using
Hibernate to process the requests manually via a Spring MVC Controller class
(not recommended)
- archetype-smartgwt-example-restserver:
llustrates use of the Smart GWT
RESTHandler
servlet
to
easily provide data access to clients other than Smart GWT / SmartGWT (mobile,
Swing, native, etc).
- archetype-smartgwt-example-spring-hibernate3-dmi:
llustrates a DataSource accessing a Spring bean using Direct Method Invocation (DMI),
which then services the request manually via Hibernate.