users@jersey.java.net

Re: [Jersey] Mavenizing Jersey - first steps done - contribs and helloworld samples

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Mon, 26 May 2008 12:26:02 +0200

On Mon, 2008-05-26 at 11:53 +0200, Paul Sandoz wrote:
> Martin Grotzke wrote:
> > On Mon, 2008-05-26 at 09:43 +0200, Paul Sandoz wrote:
> >> Hi Martin,
> >>
> >> This looks really good. I agree with merging back to the trunk sooner
> >> rather than later.
> > What prevents us from doing this right now?
> >
>
> Nothing :-) I think it can be done today, but with one request for a
> constraint, namely backwards compatibility, see below...
Great :)

Are you going to do the merge or shall I do it (after open issues are
clarified)?

>
>
> >> In the interim period we just need to make sure we
> >> can produce the same bits directly using ant [*] (i am currently
> >> depending on the NB ant project for development).
> > What do you mean with "produce the same bits directly using ant?
> >
>
> I mean the zip files (including the existing non-mavenized examples) as
> some developers rely on those that are pushed to java.net.
What zip-files do you mean? Do you have a link where to find them?

Is this a source-distribution of the whole jersey project, including
samples, contribs and jersey (modules)?

I don't know what your requirement actually is. Is it, that this
artifact / these artifacts can also be created with maven? Or is it,
that artifacts that will be created by maven can also be created by ant?

*somehow confused* :)

>
>
> > As I read in Adam Bien's blog [1] integration of maven into NB is really
> > smooth. Did you try to open the mavenized jersey project from the branch
> > with NB?
> >
>
> I agree that Maven support in NB is looking really good, but i am sure
> there will be issues with maven and the mysterious versions (see the
> unit test issue in NB for running the spring unit tests).
>
> So i would prefer to be a little conservative, if we can, to retain
> backwards compatibility while transitioning so that it does not disrupt
> development productivity in the interim (there is lots of development
> stuff to do and i don't have time just now to go on a diversion into the
> 7th circle of maven hell :-) if i cannot debug or run unit test properly).
The jersey stuff (trunk/jersey/jersey) is not changed at all, including
trunk/jersey/jersey/examples - this is exactly the same as before.

I only added trunk/jersey/samples and made changes to code of examples
therein.

> >
> >> Re: the use of PackagesResourceConfig. I thought this would be the
> >> case :-) I wonder if there is anything we could do with respect to
> >> maven to simply the configuration, e.g. a Jersey maven plugin that
> >> executes using say the Grizzly container?
> > Perhaps a grizzly-maven-plugin would be sufficient, if one could specify
> > appropriate configuration...?
> >
>
> I think one could declare the packages as an argument to the plugin.
Yep, exactly. I don't know anything about grizzly, but iIf one could
configure servlets with its init-params this would be exactly what we
want.
So we could ask the grizzly community if there are already plans for
stuff like this :)

Cheers,
Martin

>
> Paul.
>
>
> > Cheers,
> > Martin
> >
> >
> > [1] http://www.adam-bien.com/roller/abien/entry/netbeans_stairway_to_maven
> >
> >> Paul.
> >>
> >> [*] BTW when i run the spring-contrib unit tests on the command line
> >> things work fine, but when i run them in NBs some fail, i have no
> >> idea why...
> >>
> >>
> >> On May 25, 2008, at 5:45 PM, Martin Grotzke wrote:
> >>
> >>> 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
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> >> For additional commands, e-mail: users-help_at_jersey.dev.java.net
> >