mirror of https://github.com/apache/maven.git
o adding a plugin that uses properties to test MNG-2843
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@516837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4420b7e65
commit
c234efcbba
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ Copyright 2005-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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>maven-it-plugins</artifactId>
|
||||||
|
<groupId>org.apache.maven.its.plugins</groupId>
|
||||||
|
<version>1-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>maven-it-plugin-uses-properties</artifactId>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
<name>Maven Integration Test Plugin :: Uses Properties Plugin</name>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<inceptionYear>2006</inceptionYear>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.apache.maven.plugin.coreit;
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Take some configuration values that use interpolated POM values and write them to a properties file
|
||||||
|
* to make sure they are passing through the system properly. We have reports (MNG-1927) that we're
|
||||||
|
*
|
||||||
|
* @goal generate-properties
|
||||||
|
*/
|
||||||
|
public class UsesPropertiesMojo
|
||||||
|
extends AbstractMojo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @parameter expression=${basedir}"
|
||||||
|
*/
|
||||||
|
private File basedir;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @parameter expression="${project.properties}"
|
||||||
|
*/
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
public void execute()
|
||||||
|
throws MojoExecutionException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileOutputStream fos = new FileOutputStream( new File( basedir, "target/project.properties" ) );
|
||||||
|
|
||||||
|
properties.store( fos, "# Properties generated by the execution of a mojo that uses interpolated POM values for configuration." );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
getLog().error( "Error creating mojo generated properties.", e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@
|
||||||
<module>maven-it-plugin-packaging</module>
|
<module>maven-it-plugin-packaging</module>
|
||||||
<module>maven-it-plugin-parameter-implementation</module>
|
<module>maven-it-plugin-parameter-implementation</module>
|
||||||
<module>maven-it-plugin-setter</module>
|
<module>maven-it-plugin-setter</module>
|
||||||
<module>maven-it-plugin-touch</module>
|
<module>maven-it-plugin-touch</module>
|
||||||
|
<module>maven-it-plugin-uses-properties</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue