WOCreator
"maven-wocreator-plugin" is a Maven plug-in that can be used to create initial Maven 2-based project templates for J2EE WebObjects applications.
You do not need this plug-in in order to use Maven to build WebObjects applications -- it just takes away some of the manual steps in creating the initial project structure. It's equivalent to XCode's "New WebObjects Application" Wizard or WOLips's "New WOApplication", for creating a boilerplate WebObjects application, in this case ready to build and deploy as a conventional J2EE WAR.
Developing with, and deploying, the produced WAR project requires only Maven 2 and Java, with no particular IDE, Operating System or SDK (WebObjects) dependencies.
Prerequisites
- Maven 2.x should be installed and functioning (which implies a Java installation).
- A working internet connection.
- Access to a Maven 2 repository containing the WebObjects runtime jars (where can I find one?)
There are no other OS, IDE or SDK requirements for basic usage.
Installation
- Download the latest source code and expand the archive.
- Install the maven-wocreator-plugin in your local maven repository by
executing the following Maven 2 command from a command-line inside the
expanded archive:
> mvn install
Usage
To create a new Maven-based WebObjects J2EE project called 'HelloMavenWOrld', execute the following command from a command-line inside the directory where you want to store your project:
> mvn com.bbc.newsi.mvn.plugins:maven-wocreator-plugin:create-project \ -DgroupId=org.example \ -DprojectName=HelloMavenWOrld \ -Drepository=[http://somedomain.com/repo] \ -DwebObjectsVersion=5.3.3
Replace [http://somedomain.com/repo] with a url that points to a Maven repository containing the WebObjects .jars, which might typically be your internal corporate Maven or Archiva repository.
This will create a Maven project template with two modules:
- 'HelloMavenWOrld-application', which is where your source code, components, etc reside, and as such is the focus of your development. This is built into a jar representing WebObjects' 'main application bundle' at runtime. As per standard practice, your custom java source resides under /src/main/java. WOComponents, EOModels and other resources need to be placed in /src/main/resources/Resources in order to be found by NSBundle at runtime. To add third party or custom jars, simply reference them as a dependency in the Maven pom.xml.
- 'HelloMavenWOrld-war', which is required at build time in order to package your application, and any jars it depends upon, into a WAR. The only thing you might typically need to modify in here is the key-value pairs in the web.xml.
The template project should build and run without any modification. You can test this by executing the following Maven command from a command-line inside the newly created 'HelloMavenWOrld' directory:
> mvn package
... which should compile and build (downloading any dependencies required the first time around from your specified Maven repository and the internet), followed by ...
> mvn jetty:run-war
... to run your WAR within the lightweight Jetty container. (As per usual with Maven-based development, you do not need to have installed Jetty; all required components will be downloaded and installed by Maven the first time you issue this command.)
To access your running application, direct your browser at: http://localhost:8080/HelloMavenWOrld/WebObjects/HelloMavenWOrld.woa
... substituting host name and application name as applicable.
Demonstration
The following screen-cast was prepared as a 'backup' for a live presentation at the inaugural WOWODC conference (in case the live presentation went pear-shaped). Thankfully it wasn't needed on the day, but is included here to show how the 'wocreator' plugin can be used.
Please Note: Some details in the screen-cast are incorrect. For example, the plugin should be downloaded from the sourceforge site, not the url given in the screen-cast.