You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by pg...@apache.org on 2009/11/19 00:26:45 UTC

svn commit: r881997 - in /maven/ant-tasks/trunk: ./ src/main/java/org/apache/maven/artifact/ant/ src/main/resources/org/apache/maven/artifact/ant/ src/site/apt/examples/

Author: pgier
Date: Wed Nov 18 23:26:45 2009
New Revision: 881997

URL: http://svn.apache.org/viewvc?rev=881997&view=rev
Log:
[MANTTASKS-168] Add new task to write a pom to a file.

Added:
    maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java   (with props)
    maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt   (with props)
Modified:
    maven/ant-tasks/trunk/sample.build.xml
    maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
    maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/Pom.java
    maven/ant-tasks/trunk/src/main/resources/org/apache/maven/artifact/ant/antlib.xml
    maven/ant-tasks/trunk/src/site/apt/examples/pom.apt

Modified: maven/ant-tasks/trunk/sample.build.xml
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/sample.build.xml?rev=881997&r1=881996&r2=881997&view=diff
==============================================================================
--- maven/ant-tasks/trunk/sample.build.xml (original)
+++ maven/ant-tasks/trunk/sample.build.xml Wed Nov 18 23:26:45 2009
@@ -25,7 +25,7 @@
     on your local system.  This allows the deploy taks to scp artifacts to a local
     test repository.
 
-    How you start sshd will depend on your system.  For example on Fedora,
+    How you start sshd will depend on your system.  For example on Fedora Linux,
     you can start the ssh deamon using "service sshd start"
 
   -->

Modified: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java?rev=881997&r1=881996&r2=881997&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java (original)
+++ maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/AbstractArtifactTask.java Wed Nov 18 23:26:45 2009
@@ -41,8 +41,10 @@
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.profiles.DefaultProfileManager;
 import org.apache.maven.profiles.ProfileManager;
+import org.apache.maven.project.DefaultProjectBuilderConfiguration;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuilderConfiguration;
 import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.settings.Mirror;
 import org.apache.maven.settings.RuntimeInfo;
@@ -104,15 +106,10 @@
 
     protected ArtifactRepository createLocalArtifactRepository()
     {
-        if ( localRepository == null )
-        {
-            localRepository = getDefaultLocalRepository();
-        }
-
         ArtifactRepositoryLayout repositoryLayout =
-            (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, localRepository.getLayout() );
+            (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, getLocalRepository().getLayout() );
 
-        return new DefaultArtifactRepository( "local", "file://" + localRepository.getPath(), repositoryLayout );
+        return new DefaultArtifactRepository( "local", "file://" + getLocalRepository().getPath(), repositoryLayout );
     }
 
     /**
@@ -533,25 +530,37 @@
         return pom;
     }
 
-    protected Pom createDummyPom( ArtifactRepository localArtifactRepository )
+    protected Pom createDummyPom( ArtifactRepository localRepository )
+    {
+        Pom pom = new Pom();
+
+        pom.setMavenProject( createMinimalProject( localRepository ) );
+
+        return pom;
+    }
+    
+    /**
+     * Create a minimal project when no POM is available.
+     * 
+     * @param localRepository
+     * @return
+     */
+    protected MavenProject createMinimalProject( ArtifactRepository localRepository )
     {
         MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
+        DefaultProjectBuilderConfiguration builderConfig = new DefaultProjectBuilderConfiguration( );
+        builderConfig.setLocalRepository( localRepository );
+        builderConfig.setGlobalProfileManager( getProfileManager() );
 
-        MavenProject mavenProject;
         try
         {
-            mavenProject = projectBuilder.buildStandaloneSuperProject( localArtifactRepository, getProfileManager() );
+            return projectBuilder.buildStandaloneSuperProject( builderConfig );
         }
         catch ( ProjectBuildingException e )
         {
             throw new BuildException( "Unable to create dummy Pom", e );
         }
-
-        Pom pom = new Pom();
-
-        pom.setMavenProject( mavenProject );
-
-        return pom;
+        
     }
     
     protected Artifact createDummyArtifact()
@@ -653,6 +662,10 @@
 
     public LocalRepository getLocalRepository()
     {
+        if ( localRepository == null )
+        {
+            localRepository = getDefaultLocalRepository();
+        }
         return localRepository;
     }
 

Modified: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/Pom.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/Pom.java?rev=881997&r1=881996&r2=881997&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/Pom.java (original)
+++ maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/Pom.java Wed Nov 18 23:26:45 2009
@@ -23,9 +23,15 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.CiManagement;
+import org.apache.maven.model.Contributor;
+import org.apache.maven.model.Dependency;
 import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.Developer;
 import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.model.IssueManagement;
+import org.apache.maven.model.License;
+import org.apache.maven.model.MailingList;
+import org.apache.maven.model.Model;
 import org.apache.maven.model.Organization;
 import org.apache.maven.model.Reporting;
 import org.apache.maven.model.Repository;
@@ -50,18 +56,16 @@
 import java.util.Properties;
 
 /**
- * A POM typedef.
- *
- * Also an Ant Task that registers a handler called POMPropertyHelper that intercepts all calls to property value
- * resolution and replies instead of Ant to properties that start with the id of the pom.
- *
- * Example: ${maven.project.artifactId}
- *
+ * A POM typedef. Also an Ant Task that registers a handler called POMPropertyHelper that intercepts all calls to
+ * property value resolution and replies instead of Ant to properties that start with the id of the pom. Example:
+ * ${maven.project.artifactId}
+ * 
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @author <a href="mailto:nicolaken@apache.org">Nicola Ken Barozzi</a>
  * @version $Id$
  */
-public class Pom extends AbstractArtifactWithRepositoryTask
+public class Pom
+    extends AbstractArtifactWithRepositoryTask
 {
     private String refid;
 
@@ -72,7 +76,7 @@
     private File file;
 
     private List profiles = new ArrayList();
-    
+
     private boolean inheritAllProperties = true;
 
     /**
@@ -105,28 +109,37 @@
         this.antId = id;
     }
 
-    protected Pom getInstance()
+    /**
+     * Retrieve the pom object from the current Ant project using the configured refid.
+     * 
+     * @param refid
+     * @return
+     */
+    protected void getPomFromAntProject( String refid )
     {
-        Pom instance = this;
-        if ( refid != null )
+        if ( refid == null )
         {
-            instance = (Pom) getProject().getReference( refid );
-            if ( instance == null )
-            {
-                throw new BuildException( "Invalid reference: '" + refid + "'" );
-            }
+            throw new BuildException( "POM refid is null." );
+        }
+
+        if ( getProject().getReference( refid ) == null )
+        {
+            throw new BuildException( "Unable to locate POM reference: '" + refid + "'" );
         }
-        return instance;
+
+        Pom thePom = (Pom) getProject().getReference( refid );
+        mavenProject = thePom.getMavenProject();
+        file = thePom.getFile();
     }
 
     public void setMavenProject( MavenProject mavenProject )
     {
-        getInstance().mavenProject = mavenProject;
+        this.mavenProject = mavenProject;
     }
 
     public File getFile()
     {
-        return getInstance().file;
+        return file;
     }
 
     public void setFile( File file )
@@ -136,12 +149,12 @@
 
     public List getProfiles()
     {
-    	return profiles;
+        return profiles;
     }
 
-    public void addProfile(Profile activeProfile)
+    public void addProfile( Profile activeProfile )
     {
-    	this.profiles.add(activeProfile);
+        this.profiles.add( activeProfile );
     }
 
     public Artifact getArtifact()
@@ -170,13 +183,6 @@
 
     void initialise( MavenProjectBuilder builder, ArtifactRepository localRepository )
     {
-        if ( mavenProject != null )
-        {
-            log( "POM is already initialized for: " + mavenProject.getId(), Project.MSG_DEBUG );
-
-            return;
-        }
-        // TODO: should this be in execute() too? Would that work when it is used as a type?
         if ( file != null )
         {
             addAntRepositoriesToProfileManager();
@@ -192,13 +198,17 @@
         }
         else if ( refid != null )
         {
-            getInstance().initialise( builder, localRepository );
+            this.getPomFromAntProject( refid );
         }
     }
 
     protected MavenProject getMavenProject()
     {
-        return getInstance().mavenProject;
+        if ( mavenProject == null )
+        {
+            mavenProject = createMinimalProject( createLocalArtifactRepository() );
+        }
+        return mavenProject;
     }
 
     public String getArtifactId()
@@ -336,6 +346,10 @@
      */
     protected void doExecute()
     {
+        if ( getId() == null )
+        {
+            throw new BuildException( "id required for pom task" );
+        }
         ArtifactRepository localRepo = createLocalArtifactRepository();
         MavenProjectBuilder projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
         initialise( projectBuilder, localRepo );
@@ -345,7 +359,7 @@
         // Add a reference to this task/type
         antProject.addReference( antId, this );
 
-        // Register the property interceptor
+        // Register the property intercepter
         PropertyHelper phelper = PropertyHelper.getPropertyHelper( antProject );
         helper.setNext( phelper.getNext() );
         helper.setProject( antProject );
@@ -353,9 +367,10 @@
     }
 
     /**
-     * The property interceptor that handles the calls for "pom." properties
+     * The property intercepter that handles the calls for "pom." properties
      */
-    private class POMPropertyHelper extends PropertyHelper
+    private class POMPropertyHelper
+        extends PropertyHelper
     {
         /**
          * The method that gets called by Ant with every request of property
@@ -438,7 +453,7 @@
         getProfileManager().addProfile( repositoriesProfile );
         getProfileManager().explicitlyActivate( repositoriesProfile.getId() );
     }
-    
+
     private ProfileManager getActivatedProfiles()
     {
         ProfileManager profileManager = getProfileManager();
@@ -465,24 +480,23 @@
         }
         return profileManager;
     }
-    
-    /** 
+
+    /**
      * Create a project builder configuration to be used when initializing the maven project.
      * 
      * @return
      */
-    private ProjectBuilderConfiguration createProjectBuilderConfig( ArtifactRepository localArtifactRepository)
+    private ProjectBuilderConfiguration createProjectBuilderConfig( ArtifactRepository localArtifactRepository )
     {
         ProjectBuilderConfiguration builderConfig = new DefaultProjectBuilderConfiguration();
         builderConfig.setLocalRepository( localArtifactRepository );
         builderConfig.setGlobalProfileManager( this.getActivatedProfiles() );
         builderConfig.setUserProperties( getAntProjectProperties() );
-        builderConfig.setExecutionProperties(  getAntProjectProperties()  );
-        
+        builderConfig.setExecutionProperties( getAntProjectProperties() );
+
         return builderConfig;
     }
 
-
     /**
      * Convert the Hashtable of Ant project properties to a Properties object
      * 
@@ -501,20 +515,20 @@
             propsTable = getProject().getUserProperties();
         }
         Iterator propsIter = propsTable.keySet().iterator();
-        
+
         while ( propsIter.hasNext() )
         {
-            String key = (String)propsIter.next();
-            String value = (String)propsTable.get( key );
+            String key = (String) propsIter.next();
+            String value = (String) propsTable.get( key );
             properties.setProperty( key, value );
         }
-        
+
         return properties;
     }
 
     /**
-     * If set to true, all properties are passed to the maven pom.
-     * If set to false, only user properties are passed to the pom.
+     * If set to true, all properties are passed to the maven pom. If set to false, only user properties are passed to
+     * the pom.
      * 
      * @param inheritAllProperties
      */
@@ -527,5 +541,100 @@
     {
         return inheritAllProperties;
     }
+
+    public Model getModel()
+    {
+        return getMavenProject().getModel();
+    }
+
+    public void setGroupId( String groupId )
+    {
+        getMavenProject().setGroupId( groupId );
+    }
+
+    public void setArtifactId( String artifactId )
+    {
+        getMavenProject().setArtifactId( artifactId );
+    }
+
+    public void setVersion( String version )
+    {
+        getMavenProject().setVersion( version );
+    }
+
+    public void addConfiguredCiManagement( CiManagement ciManagement )
+    {
+        getMavenProject().setCiManagement( ciManagement );
+    }
+
+    public void addConfiguredContributor ( Contributor contributor )
+    {
+        getMavenProject().addContributor( contributor );
+    }
+
+    public void addConfiguredDependency( Dependency dependency )
+    {
+        getMavenProject().getDependencies().add( dependency );
+    }
+
+    public void addConfiguredDependencyManagement( DependencyManagement dependencyManagement )
+    {
+        getMavenProject().getDependencyManagement().setDependencies( dependencyManagement.getDependencies() );
+    }
+
+    public void setDescription( String description )
+    {
+        getMavenProject().setDescription( description );
+    }
+
+    public void addConfiguredDeveloper( Developer developer )
+    {
+        getMavenProject().addDeveloper( developer );
+    }
+
+    public void setInceptionYear( String inceptionYear )
+    {
+        getMavenProject().setInceptionYear( inceptionYear );
+    }
+
+    public void addConfiguredIssueManagement( IssueManagement issueManagement )
+    {
+        getMavenProject().setIssueManagement( issueManagement );
+    }
     
+    public void addConfiguredLicense ( License license )
+    {
+        getMavenProject().addLicense( license );
+    }
+    
+    public void addConfiguredMailingLists( MailingList mailingList )
+    {
+        getMavenProject().addMailingList( mailingList );
+    }
+
+    public void setName( String name )
+    {
+        getMavenProject().setName( name );
+    }
+
+    public void addConfiguredOrganization( Organization organization )
+    {
+        getMavenProject().setOrganization( organization );
+    }
+
+    public void setPackaging( String packaging )
+    {
+        getMavenProject().setPackaging( packaging );
+    }
+
+    public void addConfiguredScm( Scm scm )
+    {
+        getMavenProject().setScm( scm );
+    }
+
+    public void setUrl( String url )
+    {
+        getMavenProject().setUrl( url );
+    }
+
 }

Added: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java?rev=881997&view=auto
==============================================================================
--- maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java (added)
+++ maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java Wed Nov 18 23:26:45 2009
@@ -0,0 +1,131 @@
+package org.apache.maven.artifact.ant;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.WriterFactory;
+
+/**
+ * Write a POM to a file.
+ * 
+ * @since 2.1.0
+ */
+public class WritePomTask
+    extends Task
+{
+    private String pomRefId;
+
+    private File file;
+    
+    private boolean trim = true;
+
+    public void execute()
+    {
+        // check valid configuration
+        Pom pom = (Pom) getProject().getReference( pomRefId );
+        Model model = pom.getModel();
+        if ( trim )
+        {
+            trimModel ( model );            
+        }
+        writeModel ( model, file );
+    }
+    
+    /**
+     * Removes a lot of unnecessary information from the POM.
+     * This includes the build section, reporting, repositories, etc.
+     */
+    public void trimModel( Model model )
+    {
+        model.setBuild( null );
+        model.setReporting( null );
+        model.setProperties( null );
+        model.setRepositories( null );
+        model.setPluginRepositories( null );
+        model.setProfiles( null );
+        model.setDistributionManagement( null );
+        model.setModules( null );
+    }
+
+    /**
+     * Write a POM model to a file
+     * 
+     * @param model
+     * @return
+     * @throws MojoExecutionException
+     */
+    public void writeModel( Model model, File outputFile )
+        throws BuildException
+    {
+        Writer fw = null;
+        try
+        {
+            fw = WriterFactory.newXmlWriter( outputFile );
+            new MavenXpp3Writer().write( fw, model );
+
+        }
+        catch ( IOException e )
+        {
+            throw new BuildException( "Error writing temporary pom file: " + e.getMessage(), e );
+        }
+        finally
+        {
+            IOUtil.close( fw );
+        }
+    }
+
+    public void setPomRefId( String pomRefId )
+    {
+        this.pomRefId = pomRefId;
+    }
+
+    public String getPomRefId()
+    {
+        return pomRefId;
+    }
+
+    public void setFile( File file )
+    {
+        this.file = file;
+    }
+
+    public File getFile()
+    {
+        return file;
+    }
+
+    public void setTrim( boolean trim )
+    {
+        this.trim = trim;
+    }
+
+    public boolean isTrim()
+    {
+        return trim;
+    }
+}

Propchange: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/ant-tasks/trunk/src/main/java/org/apache/maven/artifact/ant/WritePomTask.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/ant-tasks/trunk/src/main/resources/org/apache/maven/artifact/ant/antlib.xml
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/main/resources/org/apache/maven/artifact/ant/antlib.xml?rev=881997&r1=881996&r2=881997&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/main/resources/org/apache/maven/artifact/ant/antlib.xml (original)
+++ maven/ant-tasks/trunk/src/main/resources/org/apache/maven/artifact/ant/antlib.xml Wed Nov 18 23:26:45 2009
@@ -6,6 +6,7 @@
   <taskdef name="deploy" classname="org.apache.maven.artifact.ant.DeployTask"/>
   <taskdef name="install-provider" classname="org.apache.maven.artifact.ant.InstallWagonProviderTask"/>
   <taskdef name="mvn" classname="org.apache.maven.artifact.ant.Mvn"/>
+  <taskdef name="writePom" classname="org.apache.maven.artifact.ant.WritePomTask"/>
 
   <!-- Types -->
   <typedef name="localRepository" classname="org.apache.maven.artifact.ant.LocalRepository"/>

Modified: maven/ant-tasks/trunk/src/site/apt/examples/pom.apt
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/site/apt/examples/pom.apt?rev=881997&r1=881996&r2=881997&view=diff
==============================================================================
--- maven/ant-tasks/trunk/src/site/apt/examples/pom.apt (original)
+++ maven/ant-tasks/trunk/src/site/apt/examples/pom.apt Wed Nov 18 23:26:45 2009
@@ -28,9 +28,15 @@
  ~~ NOTE: For help with the syntax of this file, see:
  ~~ http://maven.apache.org/doxia/references/apt-format.html
 
-The Pom Task
+Introduction
+
+  The pom task can be used in one of two ways, either to read an existing pom file
+  (typically pom.xml), or to define an in memory pom object.  Either technique
+  can be used to resolve build dependencies, build the project classpath, and/or
+  define project properties.
+
+Reading an exising POM file
 
-  In order to use the pom task, you will first need to define a pom (typically pom.xml).
   An example pom is provided here:
 
 -----
@@ -81,6 +87,26 @@
   This is all that is required for most projects. However, it is also possible to use other fields available in
   Maven to describe your project, and reference them from your build script.
 
+  Once the pom file is created, it can be read by the pom task.
+
+-----
+  <artifact:pom id="mypom" file="pom.xml" />
+-----
+
+Defining a POM in Ant
+
+  If a POM file is not available, the ant task can also be used to define an in-memory pom.
+  
+----
+  <artifact:pom id="mypom" groupId="org.acme" artifactId="project1" version="1.0">
+    <dependency groupId="junit" artifactId="junit" version="4.1"/>
+    <dependency groupId="org.codehaus.plexus" artifactId="plexus-utils" version="1.5.5"/>
+    <license name="apache" url="http://www.apache.org"/>
+  </artifact:pom>
+----
+
+Accessing POM information
+
   To access a part of the POM as an Ant property, you must define it as a reference. For example, to access the version from a POM,
   you can use the following:
 

Added: maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt
URL: http://svn.apache.org/viewvc/maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt?rev=881997&view=auto
==============================================================================
--- maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt (added)
+++ maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt Wed Nov 18 23:26:45 2009
@@ -0,0 +1,93 @@
+ ------
+ WritePom
+ ------
+ Paul Gier
+ ------
+ 2009-11-18
+ ------
+
+ ~~ 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.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html
+
+The WritePom Task
+
+  <<Note: This task is available since version 2.1.0>>
+
+  The WritePom task can be used to generate a POM file based on information defined in 
+  the Ant build.  For example, this could be used to generate a POM used when 
+  deploying build artifacts to a Maven repository.
+
+  The first step is to define a pom using the pom task.
+
+-----
+  <artifact:pom id="mypom1" groupId="org.acme" artifactId="project1" version="1.0" name="My awesome project">
+    <license name="apache" url="http://www.apache.org"/>
+    <dependency groupId="junit" artifactId="junit" version="4.1" scope="test"/>
+    <dependency groupId="org.codehaus.plexus" artifactId="plexus-utils" version="1.5.5"/>
+  </artifact:pom>
+----
+
+  The next step is to call the writePom task using the pom id created above.
+  
+----
+  <artifact:writepom pomRefId="mypom1" file="target/mypom1.xml"/>
+----
+
+  This will generate a pom in the location specified.
+  
+----
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.acme</groupId>
+  <artifactId>project1</artifactId>
+  <version>1.0</version>
+  <name>My awesome project</name>
+  <licenses>
+    <license>
+      <name>apache</name>
+      <url>http://www.apache.org/</url>
+    </license>
+  </licenses>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.5.5</version>
+      <scope>compile</scope>
+    </dependency>
+  </dependencies>
+</project>
+----  
+  
+  By default the <<<writePom>>> task will not include unnecessary information such as build configuration, 
+  repositories, and profiles.  If this information is needed in the pom, the "trim" option can be set to false.
+
+----
+  <artifact:writepom pomRefId="mypom1" file="target/mypom1.xml" trim="false"/>
+----
+  
\ No newline at end of file

Propchange: maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/ant-tasks/trunk/src/site/apt/examples/write-pom.apt
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"