blob: 2812931b81365652a7c43bf98f58c3b0192eeead [file] [log] [blame]
------
Usage
------
Dennis Lundberg
------
2011-05-01
------
~~ 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.
Usage
There are a couple things you need to do to use Maven Shared Resources. First
you need to give the plugin that will use the resources access to them. After
that you configure the plugin to actually use the resources.
* Add the resources to the plugin
First you add maven-shared-resources as a dependency to a plugin in your
<<<pom.xml>>>. This is done to give the plugin access to the resources within
the maven-shared-resources JAR file. In this example we will use the resources
in Maven Changes Plugin.
+----------+
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.4</version>
<configuration>
...
</configuration>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
...
</executions>
</plugin>
</plugins>
</build>
...
</project>
+----------+
* Configure the plugin to use the resources
Now you can use the resources in the plugin. You can use them as if they
existed in your own project, like this:
+----------+
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.4</version>
<configuration>
<templateDirectory>org/apache/maven/plugins</templateDirectory>
</configuration>
<dependencies>
...
</dependencies>
<executions>
...
</executions>
</plugin>
</plugins>
</build>
...
</project>
+----------+
or like this:
+----------+
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.14</version>
<configuration>
<configLocation>config/maven_checks.xml</configLocation>
<headerLocation>config/maven-header.txt</headerLocation>
</configuration>
<dependencies>
...
</dependencies>
<executions>
...
</executions>
</plugin>
</plugins>
</build>
...
</project>
+----------+
* Execute the plugin
All is now set up to make use of the resources in the plugin for your project.
Execute the plugin like you would normally do, to see the resources put to
practical use.
+----------+
mvn changes:announcement-generate
+----------+