Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.apache.maven.plugin.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;
 
Clean all Ant build files.

Author(s):
Vincent Siveton
Version:
$Id: AntCleanMojo.java 764451 2009-04-13 13:29:52Z bentmann $
Goal:
clean
 
 public class AntCleanMojo
     extends AbstractMojo
 {
     // ----------------------------------------------------------------------
     // Mojo components
     // ----------------------------------------------------------------------
 
     // ----------------------------------------------------------------------
     // Mojo parameters
     // ----------------------------------------------------------------------
 
    
The working project.

Parameter:
default-value="${project}"
Required:
Readonly:
 
     private MavenProject project;

    
Forcing the deletion of the custom build.xml.

Since:
2.2
Parameter:
expression="${deleteCustomFiles}" default-value="false"
 
     private boolean deleteCustomFiles;

    
 
     public void execute()
         throws MojoExecutionException
     {
         File buildXml = new File.getBasedir(), . );
         if ( buildXml.exists() )
         {
             if (  )
             {
                 if ( !buildXml.delete() )
                 {
                     throw new MojoExecutionException"Cannot delete " + buildXml.getAbsolutePath() );
                 }
             }
             else if ( getLog().isInfoEnabled() )
             {
                 getLog().info(
                                "Not deleting custom " + buildXml.getName()
                                    + ", use -DdeleteCustomFiles=true to force its deletion" );
             }
         }
 
         File mavenBuildXml = new File.getBasedir(), . );
         if ( mavenBuildXml.exists() && !mavenBuildXml.delete() )
         {
             throw new MojoExecutionException"Cannot delete " + mavenBuildXml.getAbsolutePath() );
         }
 
         File mavenBuildProperties =
         if ( mavenBuildProperties.exists() && !mavenBuildProperties.delete() )
         {
             throw new MojoExecutionException"Cannot delete " + mavenBuildProperties.getAbsolutePath() );
         }
 
         getLog().info(
                        "Deleted Ant build files for project " + .getArtifactId() + " in "
                           + .getBasedir().getAbsolutePath() );
    }
New to GrepCode? Check out our FAQ X