Plugin Documentation

Goals available for this plugin:

GoalDescription
spring:loadLoad a Spring context XML file optionally filtering it using Maven properties before doing so. If exportProperties is true, Maven properties are exported to the file system prior to loading and filtering the Spring context. The path to the exported properties file is automatically added to the Maven properties under the key maven.spring.properties. This combination makes it simple to inject the complete set of Maven properties into a Spring context.

One method for doing so, is to include this configuration in a Maven pom:
<plugin>
  <groupId>org.kuali.maven.plugins</groupId>
  <artifactId>spring-maven-plugin</artifactId>
  <configuration>
    <filterContext>true</filterContext>
    <filterInclude>maven.spring.properties</filterInclude>
    <contextLocation>classpath:my-context.xml</contextLocation>
  </configuration>
</plugin>
and then include this configuration in a Spring context XML file:
<context:property-placeholder location="${maven.spring.properties}" />
Using this configuration, mvn spring:load will filter my-context.xml replacing ${maven.spring.properties} with the location of the properties file Maven properties were exported to. When the Spring context is loaded, Maven properties will be used to perform placeholder substitution. This makes it possible to easily take advantage of Maven configuration like project.artifactId in the Spring context.

For example:
  <bean id="artifactId" class="java.lang.String">
    <constructor-arg value="${project.artifactId}" />
  </bean>

System Requirements

The following specifies the minimum requirements to run this Maven plugin:

Maven2.0
JDK1.6
MemoryNo minimum requirement.
Disk SpaceNo minimum requirement.

Usage

You should specify the version in your project's plugin configuration:

<project>
  ...
  <build>
    <!-- To define the plugin version in your parent POM -->
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.kuali.maven.plugins</groupId>
          <artifactId>spring-maven-plugin</artifactId>
          <version>1.1.5-SNAPSHOT</version>
        </plugin>
        ...
      </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
      <plugin>
        <groupId>org.kuali.maven.plugins</groupId>
        <artifactId>spring-maven-plugin</artifactId>
        <version>1.1.5-SNAPSHOT</version>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

For more information, see "Guide to Configuring Plug-ins"