Hi Simon,
Moises is correct, except that Jersey archetype does not allow you to
delete the web.xml without adding maven-war-plugin with failOnMissingWebXml
set. (see below)
However when generating the Jersey archetype a web.xml gets created with
the below comment.
I guess it means that it will work in Tomcat 6.0 but also work in Tomcat
7.0 and 8.0.
*<!-- This web.xml file is not required when using Servlet 3.0
container, see implementation details
http://jersey.java.net/nonav/documentation/latest/jax-rs.html
<
http://jersey.java.net/nonav/documentation/latest/jax-rs.html> -->*
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
The good thing about archetypes are that they are IDE independent and they
can be very handy especially for less experienced developers, but also for
experienced developers.
Netbeans creates this as for it's default webapp :
mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes
-DarchetypeArtifactId=webapp-javaee6 -DarchetypeVersion=1.5
-DarchetypeRepository=
http://repo.maven.apache.org/maven2
-DgroupId=com.github -DartifactId=test -Dversion=1.0-SNAPSHOT
-Dpackage=com.github.test -Dbasedir=/home/xxxx/src
-Darchetype.interactive=false --batch-mode archetype:generate
Something that the webapp-javaee6 archetype does that the Jersey one does
not (as I said before), is include a plugin to allow you to delete the
web.xml without Maven failing.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
*<failOnMissingWebXml>false</failOnMissingWebXml>*
</configuration>
</plugin>
My suggestion. Have a look how Netbeans creates a restful service.
It extends javax.ws.rs.core.Application to add your restful resources
instead of editing a web.xml.
regards,
Richard.
On 20 November 2014 19:15, Moises Lejter <moilejter_at_gmail.com> wrote:
> Hi!
>
> I just created a project using that archetype, too. I think all you need
> to do is remove web.xml from your project, and you would be all set...
> (All the async stuff could be configured via annotations on things, which
> you would need to do anyway...).
>
> If you mean modify the archetype so that using your updated archetype
> doesnt' result in this web.xml file - that is more complicated :-) (meaning
> I've never written an archetype myself - but I would imagine just removing
> the XML element that defines the web.xml file would do it...).
>
> Moises
>
>
> On Thu, Nov 20, 2014 at 7:35 AM, Simon Roberts <
> simon_at_dancingcloudphotography.com> wrote:
>
>> Hi I started using the maven archetype here:
>> https://jersey.java.net/documentation/latest/getting-started.html#new-webapp
>> to build Jersey projects, which I deploy on Tomcat 8, but I notice that
>> this creates things that deploy as a 2.5 container. Unfortunately, I'm not
>> very comfortable with maven, and it's not at all clear to me how I alter
>> this to configure the Servlets 3.0 container (I want to get the async
>> support to work). Can anyone help, please?
>>
>> Cheers,
>> Simon
>>
>>
>