users@jersey.java.net

Mavenizing Jersey - first steps done - contribs and helloworld samples

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Sun, 25 May 2008 17:45:41 +0200

Hi,

the first steps of mavenising jersey are done: I created a new branch
[1] and changed the main project structure:
|-- jersey
|-- repo
`-- www

The jersey folder represents the parent jersey project that contains the
modules "contrib", "jersey" and "samples". One can invoke `mvn install`
to build and install the whole project with all modules.

The directory structure and maven groupId/artifactId below trunk/jersey
looks like this:

|-- contribs
| |-- pom.xml (groupId=com.sun.jersey, artifactId=jersey-contribs)
| `-- spring
| |-- pom.xml (groupId=com.sun.jersey, artifactId=jersey-spring)
|-- jersey
| |-- maven
| | |-- pom.xml (groupId=com.sun.jersey, artifactId=jersey)
|-- pom.xml (groupId=com.sun.jersey, artifactId=jersey-project)
`-- samples
    |-- helloworld
    | |-- pom.xml (groupId=com.sun.jersey.samples, artifactId=helloworld)
    |-- helloworld-webapp
    | |-- pom.xml (groupId=com.sun.jersey.samples, artifactId=helloworld-webapp)
    `-- pom.xml (groupId=com.sun.jersey.samples, artifactId=jersey-samples)

The jersey-project pom.xml is not really complete, information like scm,
reporting, distributionManagement etc. is still missing.

I decided not to rename jersey to modules, IMHO this should be done when
jersey is split into several modules.

The helloworld sample is the example taken from
jersey/examples/HelloWorld, I only copied java classes and README.html.
For beeing able to the helloworld Main class with the exec-maven-plugin
I had to change Main.java to create an HttpHandler with an appropriate
PackagesResourceConfig.
The helloworld app now can be run via `mvn compile exec:java`, I updated
README.html accordingly.

The helloworld-webapp sample is the example taken from
jersey/examples/HelloWorldWebApp, I only copied the
HelloWorldResource.java, web.xml and README.html.
I extended web.xml with the PackageResourceConfig.
The helloworld-webapp can be run via `mvn jetty:run`, I updated
README.html to reflect this change.

This should be a good start to convert examples to a maven build.

To keep these changes in sync with upcoming commits (for jersey) IMHO it
would be the best to merge changes back into the trunk. Then all
examples can be mavenized under samples, after that jersey/examples can
be removed.

Once this is finished we can start breaking up jersey into modules.

What do you think?

Cheers,
Martin


[1] https://jersey.dev.java.net/svn/jersey/branches/mavenize-jersey