mirror of https://github.com/apache/maven.git
o a IT plugin that takes a configuration section which is a DOM and emits the fully interpolated configuration for inspection.
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@494831 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
54d36a8125
commit
5612ea0d83
|
@ -0,0 +1,54 @@
|
|||
<?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-configuration</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>Maven Integration Test Plugin :: Configuration</name>
|
||||
<description>
|
||||
A plugin that allows any configuration in the form of a DOM which allows inspection after
|
||||
configuration processing inside Maven's core.
|
||||
</description>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<inceptionYear>2001</inceptionYear>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2004 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
import org.codehaus.plexus.util.xml.Xpp3DomWriter;
|
||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
//MAPI: This is a canidate for the internal state dump (ISD). This is probably similar to what is in the help plugin.
|
||||
|
||||
/**
|
||||
* @goal config
|
||||
* @phase generate-resources
|
||||
* @description Goal produces a raw string with contains full interpolated plugin configurations.
|
||||
*/
|
||||
public class CoreItMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/** @parameter expression="${dom}" */
|
||||
private PlexusConfiguration dom;
|
||||
|
||||
/** @parameter expression="${outputDirectory}" default-value="${project.build.directory}" */
|
||||
private File outputDirectory;
|
||||
|
||||
/** @parameter expression="${fileName}" default-value="plugin-configuration.txt" */
|
||||
private String fileName;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
try
|
||||
{
|
||||
File file = new File( outputDirectory, fileName );
|
||||
|
||||
if ( !outputDirectory.exists() )
|
||||
{
|
||||
outputDirectory.mkdirs();
|
||||
}
|
||||
|
||||
Writer writer = new FileWriter( file );
|
||||
|
||||
writer.write( dom.toString() );
|
||||
|
||||
writer.close();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error writing out plugin configuration.", e );
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue