blob: caf908fbd6f3c50de9b7dd015fddaea2c5be9795 [file] [log] [blame]
------
Usage
------
Edwin Punzalan
------
2006-06-29
------
~~ 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
Usage
The Maven Clean Plugin, as the name implies, attempts to clean the files and
directories generated by Maven during its build. While there are plugins
that generate additional files, the Clean Plugin assumes that these files are
generated inside the <<<target>>> directory.
* Cleaning a Maven project using the command-line
The Clean Plugin can be called to execute in the command-line without any
additional configurations. Like the other plugins, to run the Clean Plugin,
you use:
+-----
mvn clean:clean
+-----
where the first <<<clean>>> refers to the plugin's alias, and the second
<<<clean>>> refers to the plugin goal.
However, the Clean Plugin is a special plugin and is bound to its own special
lifecycyle phase called <<<clean>>>. Thus, for simplicity, it can also be
executed by using:
+-----
mvn clean
+-----
or with other phases/goals like:
+-----
mvn clean package site
+-----
* Running the Clean Plugin automatically during a build
If for some reason, adding <<<clean>>> to the command-line is not option,
the Clean Plugin can be put into a project's <<<pom.xml>>> so that it gets executed
everytime the project is built. Below is a sample <<<pom.xml>>> for running the
Clean Plugin in the <<<initialize>>> phase everytime the project is built:
+-----
<project>
[...]
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>auto-clean</id>
<phase>initialize</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>
+-----