Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Maven Archetype for Embedded Jetty

Bringing this discussion back to the list rather than having it in the comments of the referenced bug:

Jesse McConnel Wrote in https://bugs.eclipse.org/bugs/show_bug.cgi?id=352512:

John,

taking a closer look at your archetype I wonder if the jetty-runner might not
be a better fit, or at least a more featured option, jan blogged about it a
while back and its in codehaus git repo.

http://blogs.webtide.com/janb/entry/jetty_runner


Response:

I like jetty-runner, but I was trying to do something a little different than that. I wanted dev and production execution to be identical. The main reason for that is to avoid the "works in dev, fails in test/prod" moment implicitly in the structure of the application. The means to this end is to define everything in the pom including the Jetty container and to also have Maven generate the launch script. This way the entire application comes down from git and can be built by CI and executed (like it is with the maven plugin).

Jetty-runner gets close, but it still comes from outside of the project and can be run with different configuration and parameters outside of what is in version control. In other words it's still a container that an application gets deployed to rather than the container being part of the application.

It's a little bit of a different way of developing and thinking about a web application. There are, however, many advantages and this is something that, I think, only Jetty can do well right now because of the mature history of embeddability. It's been working very well for me thus far.

This is an extension of the ideas laid out by Johannes Brodwall in his blog: http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/


On 07/19/2011 02:30 PM, Jesse McConnell wrote:
ok, fair enough

https://bugs.eclipse.org/bugs/show_bug.cgi?id=352512

I opened a bug for this and will try and track them down so we can get
our archetypes updated and factor in this one you have been working
on.  We should get it all updated and into a release build anyway.

cheers!
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx



On Tue, Jul 19, 2011 at 16:16, John Simone<jsimone@xxxxxxxxxxxxxx>  wrote:
I completely see your points. I don't want to introduce something that's
already covered in documentation. I'll try my best to speak to the value
that I see here.

The embeddability of Jetty is well explained and people are generally aware
of it. What this does goes a little further than the examples. There are
some steps between the simple embedding examples and running a full fledged
application. The Maven plugin works so well because it explicitly adds
project dependencies to the classpath before it launches. That avoids issues
like taglib resolution and makes the embedded server work more like a
general purpose application server rather than something tailored to a
single application. I haven't seen an example of doing the same thing
outside of that plugin and without building an intermediary war file.

I think that the flow of building an application with Maven, but then being
able to launch it without Maven or anything else other than Java and project
dependencies is nice and makes for a great dev/deploy flow. There were
enough headaches, for me, in making this work that I want others to be able
to skip the pain. This could be something that's just documented too, but
since this still requires Maven it makes sense, to me, as an archetype.

An archetype like this could be used two ways. It could start a project the
way the existing archetypes are likely used. It is also lightweight enough
that it can be used to create a new project that existing code can be
brought into. In both cases the archetype is a faster path to the goal than
following a "how to" would be because of the nature of the project
structure.

On 07/19/2011 11:21 AM, Jesse McConnell wrote:

http://git.eclipse.org/c/jetty/org.eclipse.jetty.project.git/tree/example-jetty-embedded/src/main/java/org/eclipse/jetty/embedded

We have these examples on how easy it is to embed and I hadn't really
seen where a maven archetype was needed so far.

Is your thought that people are generally unaware of how easy
embedding jetty is and an archetype might help get them started?  I
wonder about that because my typical use case is I have code already
and I want to then fire it up somehow, whereas the archetype flow for
me is more at the actual start of the project.  My embedding is with
the project code and rarely another complete artifact..

I am open to the idea though, how do you see people typically using
something like this?

cheers,
jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx



On Tue, Jul 19, 2011 at 13:10, John Simone<jsimone@xxxxxxxxxxxxxx>    wrote:
Are there any Maven archetypes being distributed for creating a web
application with an embedded instance of Jetty? I've seen the archetypes
here: http://www.webtide.com/resources/maven.jsp, but I'm thinking of
something that launches from a traditional main method or simple launcher
shell script rather than the maven plugin. I think this gives a little
more
control over the launch environment and allows an application to easily
be
launched by a developer in the same way it is in production (Assuming one
doesn't feel right about using Maven as a launch wrapper in production).

I put together the archetype that is referenced in this tutorial:
https://gist.github.com/1054400

Could this, or something like it, be beneficial to offer as an example of
a
different way to build applications and a way to showcase how easily
embeddable Jetty is?
_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev
_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev



Back to the top