<?xml version="1.0"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at
  
  http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<document>
  <properties>
    <title>Generating a Portlet Application</title>
    <subtitle>Using Maven to Generate a Portlet Application</subtitle>
	<authors>
		<person name="David Sean Taylor" email="taylor@apache.org" />
	</authors>
  </properties>
  <body>
    <section name="Generating a Portlet Application">
      <p>      
       Portlet applications should be stored in a separate sub-project of your main portal project.
       Our custom build is setup to put one or more portlet application projects under the <i>applications</i>
       directory. For this tutorial, we will create one portlet application. The portlet application
       will be automatically  built and deployed when you run <b>maven -P tomcat,min</b>.
       </p>
       <p>
       To create a new portal application named <b>express-demo</b>, enter the following commands:
      </p>
	 <source>
	 <![CDATA[
# Linux	 
cd /JetspeedTraining/workspace/jetexpress/applications

# Windows
cd \JetspeedTraining\workspace\jetexpress\applications

mvn archetype:create -DarchetypeGroupId=org.apache.portals.jetspeed-2 
                     -DarchetypeArtifactId=application-archetype 
                     -DarchetypeVersion=2.1 
                     -DgroupId=org.apache.portals.tutorials
                     -DartifactId=express-demo
                     -Dversion=1.0
     ]]>
	</source> 
	  <p>
	  <b>Paste into Command Line:</b>
	  <input id='genapp' size="80" value="mvn archetype:create -DarchetypeGroupId=org.apache.portals.jetspeed-2 -DarchetypeArtifactId=application-archetype -DarchetypeVersion=2.1 -DgroupId=org.apache.portals.tutorials -DartifactId=express-demo -Dversion=1.0"/>	  
	  </p>
      <p>      
       A directory named <b>express-demo</b> under <i>/JetspeedTraining/workspace/applications</i> should have been created.
       Notice that <b>express-demo</b> will be the name of your portlet application.
      </p>
      <p>
        Lets have a closer look at what was created. There is a <b>src</b> directory, and underneath it
        three subdirectories <b>java, test, webapp</b>. Under the <b>java</b> directory, there is one
        sample portlet. Under the <b>test</b> directory, you will find one unit test. Under the <b>webapp</b>
        directory, you will find a number of files that are the basic template for any useful portlet application:
     </p>
     <img src="../images/src-dir.png"/>          
     <p>
       Here you will find the portlet and servlet deployment descriptors: <b>portlet.xml</b> and <b>web.xml</b>.
       Review the files in this directory. We are going to copy over some more sample portlets for the tutorial.
       Lets let an ant task to do the work for us:
     </p>
	 <source>
	 <![CDATA[
	 ant copy-portlet-resources
     ]]>
	</source> 
     
	  <p>
	    <a href='../02/deploy-custom.html'>Previous</a> <a href='build-it.html'>Next</a>
	  </p>            
    </section>
  </body>
</document>

