org.kuali.maven.plugins.spring.MavenUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-maven-plugin Show documentation
Show all versions of spring-maven-plugin Show documentation
This plugin provides integration between Spring and Maven.
Plugin goals support loading a Spring context XML file as part of the Maven build lifecycle.
The XML file can be on the local file system or be accessible via any URL Spring's resource loading mechanism can understand.
Spring's "classpath:context.xml" style notation is supported.
Annotated Java classes can also be used to load a Spring context.
Maven properties are injected into the Spring context (both XML and annotation style) as a java.util.Properties bean named "mavenProperties".
Maven properties are also registered as a top level PropertySource so that Spring's placeholder resolution framework automatically considers them.
See Project Reports -> Plugin Documentation for details on plugin goals.
By default, the profile "maven" is set as an active Spring profile along with any other active Maven profiles.
/**
* Copyright 2011-2012 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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.
*/
package org.kuali.maven.plugins.spring;
import java.util.Properties;
import org.apache.maven.project.MavenProject;
import org.kuali.common.util.LocationUtils;
public class MavenUtils {
public static final Properties getInternalProperties(MavenProject project) {
Properties properties = new Properties();
properties.setProperty("project.id", project.getId());
properties.setProperty("project.groupId", project.getGroupId());
properties.setProperty("project.artifactId", project.getArtifactId());
properties.setProperty("project.version", project.getVersion());
properties.setProperty("project.packaging", project.getPackaging());
properties.setProperty("project.name", project.getName());
properties.setProperty("project.description", project.getDescription());
properties.setProperty("project.inceptionYear", project.getInceptionYear());
properties.setProperty("project.ciManagement.system", project.getCiManagement().getSystem());
properties.setProperty("project.ciManagement.url", project.getCiManagement().getUrl());
properties.setProperty("project.issueManagement.system", project.getIssueManagement().getSystem());
properties.setProperty("project.issueManagement.url", project.getIssueManagement().getUrl());
properties.setProperty("project.basedir", LocationUtils.getCanonicalPath(project.getBasedir()));
properties.setProperty("project.build.directory", project.getBuild().getDirectory());
properties.setProperty("project.build.outputDirectory", project.getBuild().getOutputDirectory());
properties.setProperty("project.build.testOutputDirectory", project.getBuild().getTestOutputDirectory());
properties.setProperty("project.build.sourceDirectory", project.getBuild().getSourceDirectory());
properties.setProperty("project.build.scriptSourceDirectory", project.getBuild().getScriptSourceDirectory());
properties.setProperty("project.build.testSourceDirectory", project.getBuild().getTestSourceDirectory());
return properties;
}
}