Note - In future there will be a download complete with examples. For the moment there is only a Maven archetype that creates a new application

Building a new web application with Maven

You can use Maven archetypes to quickly set up a Scimpi web application. Run the following command specifying a suitable group and artifact ID. The group ID is typically based on you domain name, while the artifact ID uniquely represents the web application you are creating.

$ mvn archetype:generate -DarchetypeCatalog=http://nakedobjects.org/snapshot-catalog.xml

When this command is running you will be prompted about how to set up the application, as the following example shows:-

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://nakedobjects.org/snapshot-catalog.xml -> application-archetype (Naked Objects Application)
2: http://nakedobjects.org/snapshot-catalog.xml -> scimpi-archetype-quickstart (A simple Scimpi application)
Choose a number:  (1/2): 2
[INFO] snapshot org.nakedobjects:scimpi-archetype-quickstart:0.4-SNAPSHOT: checking for updates from scimpi-archetype-quickstart-repo
Define value for groupId: : org.example
Define value for artifactId: : mywebapp
Define value for version:  1.0-SNAPSHOT: : 
Define value for package:  org.example: : 
Confirm properties configuration:
groupId: org.example
artifactId: mywebapp
version: 1.0-SNAPSHOT
package: org.example
 Y: : y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating OldArchetype: scimpi-archetype-quickstart:0.4-SNAPSHOT
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.example
[INFO] Parameter: packageName, Value: org.example
[INFO] Parameter: package, Value: org.example
[INFO] Parameter: artifactId, Value: mywebapp
[INFO] Parameter: basedir, Value: /home/rcm/tmp
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] OldArchetype created in dir: /home/rcm/tmp/mywebapp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 52 seconds
[INFO] Finished at: Tue Nov 17 22:27:03 GMT 2009
[INFO] Final Memory: 8M/14M
[INFO] ------------------------------------------------------------------------
$ 

Choose the Scimpi archetype (scimpi-archetype-quickstart) and provide a group and artifact IDs; together these should uniquely identify you application (see Maven for more details) .

The resulting directory (with the name from the artifact ID) contains a Maven style project for a complete example web application. So for the above example directory would also be mywebapp. The directory contains the following:-

mywebapp
|-- pom.xml
`-- src
    `-- main
        |-- java
        |   `-- org
        |       `-- example
        |-- resources
        `-- webapp
            |-- META-INF
            |   `-- MANIFEST.MF
            |-- WEB-INF
            |   |-- allow
            |   |-- logging.properties
            |   |-- nakedobjects.properties
            |   |-- passwords
            |   `-- web.xml
            |-- generic
            |   |-- action.shtml
            |   |-- collection.shtml
            |   |-- edit.shtml
            |   `-- object.shtml
            |-- images
            |   |-- Default.png
            |   |-- DomainObject.gif
            |   |-- banner.jpg
            |   |-- bg-button.gif
            |   `-- logo.png
            |-- index.shtml
            |-- login.shtml
            `-- style
                |-- screen.css
                `-- template.shtml

From within the artifact directory you can build the application by running Maven with the install goal:-

$ cd mywebapp
$ mvn install

The newly created target directory contains a war file with the name of the artifact, e.g. mywebapp-1.0-SNAPSHOT.war. This file can then be manually deployed to a suitable web server or Maven can run a web server for you.

$ mvn jetty:run

Once set up the source code for the domain model, in src/main/java/, can be replaced or modified, and specific views can be added to src/main/webapp/. Rebuild and redeploy through the same process to see the results.