You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2006/09/24 17:03:17 UTC
svn commit: r449410 - in /maven/plugins/trunk/maven-ant-plugin/src:
main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
main/java/org/apache/maven/plugin/ant/AntCleanMojo.java site/apt/index.apt
Author: vsiveton
Date: Sun Sep 24 08:03:16 2006
New Revision: 449410
URL: http://svn.apache.org/viewvc?view=rev&rev=449410
Log:
MANT-16: Create an clean goal
o Added cleanMojo
o updated documentation
Added:
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java (with props)
Modified:
maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt
Modified: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java?view=diff&rev=449410&r1=449409&r2=449410
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java Sun Sep 24 08:03:16 2006
@@ -219,7 +219,7 @@
// ----------------------------------------------------------------------
writer.startElement( "project" );
- writer.addAttribute( "name", project.getArtifactId() );
+ writer.addAttribute( "name", project.getArtifactId() + "-from-maven");
writer.addAttribute( "default", "jar" );
writer.addAttribute( "basedir", "." );
Added: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java?view=auto&rev=449410
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java (added)
+++ maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java Sun Sep 24 08:03:16 2006
@@ -0,0 +1,71 @@
+package org.apache.maven.plugin.ant;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Clean all Ant build files.
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ * @version $Id$
+ * @goal clean
+ */
+public class AntCleanMojo
+ extends AbstractMojo
+{
+ /**
+ * The working project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * @see org.apache.maven.plugin.Mojo#execute()
+ */
+ public void execute()
+ throws MojoExecutionException
+ {
+ File buildXml = new File( project.getBasedir(), AntBuildWriter.DEFAULT_BUILD_FILENAME );
+ if ( buildXml.exists() && !buildXml.delete() )
+ {
+ throw new MojoExecutionException( "Cannot delete " + buildXml.getAbsolutePath() );
+ }
+
+ File mavenBuildXml = new File( project.getBasedir(), AntBuildWriter.DEFAULT_MAVEN_BUILD_FILENAME );
+ if ( mavenBuildXml.exists() && !mavenBuildXml.delete() )
+ {
+ throw new MojoExecutionException( "Cannot delete " + mavenBuildXml.getAbsolutePath() );
+ }
+
+ File mavenBuildProperties = new File( project.getBasedir(), AntBuildWriter.DEFAULT_MAVEN_PROPERTIES_FILENAME );
+ if ( mavenBuildProperties.exists() && !mavenBuildProperties.delete() )
+ {
+ throw new MojoExecutionException( "Cannot delete " + mavenBuildProperties.getAbsolutePath() );
+ }
+
+ getLog().info(
+ "Deleted Ant project for " + project.getArtifactId() + " in "
+ + project.getBasedir().getAbsolutePath() );
+ }
+}
Propchange: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-ant-plugin/src/main/java/org/apache/maven/plugin/ant/AntCleanMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt?view=diff&rev=449410&r1=449409&r2=449410
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/site/apt/index.apt Sun Sep 24 08:03:16 2006
@@ -30,9 +30,11 @@
* Goals Overview
- The Ant Plugin has one goal:
+ The Ant Plugin has two goals:
* {{{ant-mojo.html}ant:ant}} Generate Ant build files.
+
+ * {{{clean-mojo.html}ant:clean}} Clean all Ant build files.
* Usage