cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache CXF Documentation > JAX-RS Maven Plugins
Date Fri, 06 Jan 2012 11:09:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">JAX-RS
Maven Plugins</a></h2>
    <h4>Page  <b>added</b> by             <a href="">Sergey
    <div class="notificationGreySide">
         <p><span style="font-size:2em;font-weight:bold"> JAX-RS: Maven Plugins

    <li><a href='#JAX-RSMavenPlugins-Introduction'>Introduction</a></li>
    <li><a href='#JAX-RSMavenPlugins-Archetypes'>Archetypes</a></li>

<h1><a name="JAX-RSMavenPlugins-Introduction"></a>Introduction</h1>

<p>A <a href=""
class="external-link" rel="nofollow">wadl2java</a> Maven plugin for generating the
Java code from WADL documents and a new Maven archetype for speeding up the creation of Spring-based
CXF JAX-RS web applications are currently available.  </p>

<h1><a name="JAX-RSMavenPlugins-Archetypes"></a>Archetypes</h1>

<p><a href="" class="external-link"
rel="nofollow">Maven archetypes</a> can help with creating the boilerplate code which
can be used to build a working application fast.</p>

<p>CXF 2.5.1 introduces an org.apache.cxf.archetype:cxf-jaxrs-service archetype plugin
for creating and testing a simple Spring-based JAX-RS web application.</p>

<p>Here is how you can use it from the command line.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">

mvn archetype:generate -Dfilter=org.apache.cxf.archetype:

[INFO] Scanning for projects...
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -&gt; org.apache.cxf.archetype:cxf-jaxrs-service (Simple CXF JAX-RS webapp service
using Spring configuration)
2: remote -&gt; org.apache.cxf.archetype:cxf-jaxws-javafirst (Creates a project for developing
a Web service starting from Java code)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): :
Choose version: 
1: 2.5.1
2: 2.5.2-SNAPSHOT
Choose a number: 2: 1
(10 KB at 15.2 KB/sec)
Define value for property 'groupId': :
Define value for property 'artifactId': : simple
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package': : 
Confirm properties configuration:
artifactId: simple
version: 1.0-SNAPSHOT
 Y: : Y

[INFO] project created from Archetype in dir: ~/work/archetypes/simple
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------

~/work/archetypes$ tree simple
├── pom.xml
└── src
    ├── main
    │   ├── java
    │   │   └── org
    │   │       └── examples
    │   │           └── rest
    │   │               ├──
    │   │               └──
    │   └── webapp
    │       └── WEB-INF
    │           ├── beans.xml
    │           └── web.xml
    └── test
        └── java
            └── org
                └── examples
                    └── rest

~/work/archetypes$ cd simple

~/work/archetypes/simple$ mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple CXF JAX-RS webapp service using spring configuration 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ simple ---
[INFO] Compiling 2 source files to ~/work/archetypes/simple/target/classes
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ simple ---
[INFO] Building war: ~/work/archetypes/simple/target/simple-1.0-SNAPSHOT.war
[INFO] &lt;&lt;&lt; tomcat-maven-plugin:1.1:run-war (start-tomcat) @ simple &lt;&lt;&lt;
[INFO] --- tomcat-maven-plugin:1.1:run-war (start-tomcat) @ simple ---
[INFO] Running war on http://localhost:47586/jaxrs-service
INFO: Starting tomcat server
06-Jan-2012 12:47:53 org.apache.catalina.core.StandardEngine start
INFO: Starting Coyote HTTP/1.1 on http-47586
 T E S T S
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.823 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ simple ---
[INFO] Installing ~/work/archetypes/simple/target/simple-1.0-SNAPSHOT.war to ~/.m2/repository/org/examples/rest/simple/1.0-SNAPSHOT/simple-1.0-SNAPSHOT.war
[INFO] Installing ~/work/archetypes/simple/pom.xml to ~/.m2/repository/org/examples/rest/simple/1.0-SNAPSHOT/simple-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------

<p>Note that an "org.apache.cxf.archetype:" filter is used to restrict a number of available
archetypes and then a jaxrs archetype is selected. After the sample project has been created
it is built and the integration tests are run.</p>

<p>Integration with Eclipse should also be possible.</p>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message