dion        2003/10/21 22:50:13

  Modified:    xdocs/reference/developers developer-guide.xml
  Log:
  Move how to create your first plugin to xdocs from wiki
  
  Revision  Changes    Path
  1.4       +142 -0    maven/xdocs/reference/developers/developer-guide.xml
  
  Index: developer-guide.xml
  ===================================================================
  RCS file: /home/cvs/maven/xdocs/reference/developers/developer-guide.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- developer-guide.xml       14 Oct 2003 23:58:52 -0000      1.3
  +++ developer-guide.xml       22 Oct 2003 05:50:13 -0000      1.4
  @@ -31,6 +31,148 @@
           necessarily assembled in any paricular order, but of importance
           for anyone writing a plugin.
         </p>
  +      
  +      <subsection name="How to create your first plugin">
  +        <ol>
  +          <li>
  +            Create a directory for the plugin
  +            <p>
  +              Create a local directory for the plugin source code:
  +            </p>
  +            <source>~/myprojects/maven-plugins/hello</source>
  +            
  +            <p>In this directory create the following directory structure:</p>
  +            <source>
  +./src/java 
  +./src/plugin-resources 
  +./xdocs/ 
  +            </source>
  +          </li>
  +          
  +          <li>
  +            Create the project.xml file
  +            <p>
  +              You might use this as a template for you project.xml:
  +            </p>
  +            <source>
  +&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; 
  + 
  +&lt;project&gt; 
  +    &lt;pomVersion&gt;3&lt;/pomVersion&gt; 
  +    &lt;id&gt;maven-hello-plugin&lt;/id&gt; 
  +    &lt;name&gt;Maven hello world plugin&lt;/name&gt; 
  +    &lt;currentVersion&gt;1.0.0&lt;/currentVersion&gt; 
  +    &lt;organization&gt; 
  +        &lt;name&gt;My org name&lt;/name&gt; 
  +    &lt;/organization&gt; 
  +    &lt;inceptionYear&gt;2003&lt;/inceptionYear&gt; 
  +    &lt;shortDescription&gt;Short description of the 
plugin&lt;/shortDescription&gt; 
  +    &lt;developers&gt; 
  +        &lt;developer&gt; 
  +            &lt;name&gt;Trygve Laugstøl&lt;/name&gt; 
  +            &lt;id&gt;trygvis&lt;/id&gt; 
  +            &lt;email&gt;[EMAIL PROTECTED]&lt;/email&gt; 
  +            &lt;organization&gt;My organization&lt;/organization&gt; 
  +            &lt;roles&gt; 
  +                &lt;role&gt;Developer&lt;/role&gt; 
  +            &lt;/roles&gt; 
  +        &lt;/developer&gt; 
  +    &lt;/developers&gt; 
  + 
  +    &lt;dependencies&gt; 
  +&lt;!-- 
  +        &lt;dependency&gt; 
  +            &lt;id&gt;commons-logging&lt;/id&gt; 
  +            &lt;version&gt;1.0.3&lt;/version&gt; 
  +        &lt;/dependency&gt; 
  +--&gt; 
  +    &lt;/dependencies&gt; 
  + 
  +    &lt;build&gt; 
  +        &lt;!-- Useful if your plugin uses some beans --&gt; 
  +        &lt;sourceDirectory&gt;src/java/main&lt;/sourceDirectory&gt; 
  +        
&lt;unitTestSourceDirectory&gt;src/java/test&lt;/unitTestSourceDirectory&gt; 
  + 
  +        &lt;unitTest&gt; 
  +            &lt;includes&gt; 
  +                &lt;include&gt;**/*Test.java&lt;/include&gt; 
  +            &lt;/includes&gt; 
  +        &lt;/unitTest&gt; 
  + 
  +        &lt;resources&gt; 
  +            &lt;resource&gt; 
  +                &lt;directory&gt;${basedir}/src/plugin-resources&lt;/directory&gt; 
  +                &lt;targetPath&gt;plugin-resources&lt;/targetPath&gt; 
  +            &lt;/resource&gt; 
  +            &lt;resource&gt; 
  +                &lt;directory&gt;${basedir}&lt;/directory&gt; 
  +                &lt;includes&gt; 
  +                    &lt;include&gt;plugin.jelly&lt;/include&gt; 
  +                    &lt;include&gt;plugin.properties&lt;/include&gt; 
  +                    &lt;include&gt;project.properties&lt;/include&gt; 
  +                    &lt;include&gt;project.xml&lt;/include&gt; 
  +                &lt;/includes&gt; 
  +            &lt;/resource&gt; 
  +        &lt;/resources&gt; 
  +    &lt;/build&gt; 
  +&lt;/project&gt;  
  +            </source>
  +          </li>
  +          
  +          <li>
  +            Create the plugin.jelly file
  +            <p>
  +            This file is the main file in the plugin. It contains the goals that 
make up the plugin.
  +            </p>
  +            <source>
  +&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;  
  + 
  +&lt;project&gt; 
  +    &lt;goal name="hello"&gt; 
  +        &lt;echo&gt;Hello Maven Plug-in!&lt;/echo&gt; 
  +    &lt;/goal&gt; 
  +&lt;/project&gt; 
  +            </source>
  +          </li>
  +          
  +          <li>
  +            Other useful files
  +            <p>There are a couple of other useful files that you might want to know 
of:</p>
  +            <dl>
  +              <dt>project.properties</dt>
  +              <dd>the same as always, it's for customizing the build process of the 
plugin itself.</dd>
  +              <dt>plugin.properties</dt>
  +              <dd>
  +                This is simply the default values of the properties that the plugin 
exposes for
  +                the user to customize
  +              </dd>
  +            </dl>
  +          </li>
  +          
  +          <li>
  +            Install the plugin
  +            <p>
  +              While developing a plugin you probably don't wont the plugin to be 
accessable for everyone 
  +              using the same maven installation as you.
  +            </p>
  +            <p>
  +              You can execute <source>maven plugin:deploy</source> to install the 
plugin unpacked in your local
  +              plugin directory (~/.maven/plugins).
  +            </p>
  +            <p>
  +              When you have a good version you can do <source>maven 
plugin:install</source> to install it to $MAVEN_HOME.
  +            </p>
  +          </li>
  +          
  +          <li>
  +            Invoke the plugin
  +            <p>Start maven using</p>
  +            <source>maven hello</source>
  +            <p>And there's your first plug-in!</p>
  +          </li>
  +        </ol>
  +      </subsection>
  +      
         <subsection name="Reporting Protocol">
           <p>
             If you are writing a plugin which generates output that you
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to