mirror of https://github.com/apache/maven.git
fix it with no more dependency on an external mojo.
Submitted by Stuart McCulloch
This commit is contained in:
parent
d9011e0bf5
commit
58c0f58ad0
|
@ -19,10 +19,9 @@ package org.apache.maven.it;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.maven.it.util.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5445">MNG-5445</a>.
|
||||
|
@ -33,7 +32,7 @@ public class MavenITmng5445LegacyStringSearchModelInterpolatorTest
|
|||
|
||||
public MavenITmng5445LegacyStringSearchModelInterpolatorTest()
|
||||
{
|
||||
super( ALL_MAVEN_VERSIONS );
|
||||
super( "[3.1,)" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,43 +6,30 @@
|
|||
<artifactId>mng5445-it</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
|
||||
<name>Test legacy StringSearchModelInterpolator</name>
|
||||
<name>Test StringSearchModelInterpolator with path-based properties</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<myDirectory>${project.build.sourceDirectory}/foo</myDirectory>
|
||||
</properties>
|
||||
|
||||
<prerequisites>
|
||||
<maven>2.2.1</maven>
|
||||
</prerequisites>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>0.1-stub-SNAPSHOT</version>
|
||||
<configuration>
|
||||
<testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
|
||||
<testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>versions-maven-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<artifactId>maven-it-plugin-model-interpolation</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test-display-plugin-updates</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>display-plugin-updates</goal>
|
||||
<goal>path-interpolation</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>maven-it-plugins</artifactId>
|
||||
<groupId>org.apache.maven.its.plugins</groupId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-it-plugin-model-interpolation</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
|
||||
<name>Maven IT Plugin :: Model Interpolation</name>
|
||||
<inceptionYear>2013</inceptionYear>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.1.0</version>
|
||||
</dependency>
|
||||
<!-- Test the resolution of the version -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>maven-it-helper</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-verifier</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,57 @@
|
|||
package org.apache.maven.plugin.coreit;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.interpolation.ModelInterpolationException;
|
||||
import org.apache.maven.project.interpolation.ModelInterpolator;
|
||||
|
||||
/**
|
||||
* @goal path-interpolation
|
||||
* @phase validate
|
||||
*/
|
||||
public class PathInterpolationMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/** @component */
|
||||
private ModelInterpolator modelInterpolator;
|
||||
|
||||
/** @parameter expression="${project}" */
|
||||
private MavenProject project;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
try
|
||||
{
|
||||
modelInterpolator.interpolate( project.getOriginalModel(),
|
||||
project.getBasedir(),
|
||||
new DefaultProjectBuilderConfiguration().setExecutionProperties( project.getProperties() ),
|
||||
true );
|
||||
}
|
||||
catch ( ModelInterpolationException e )
|
||||
{
|
||||
throw new MojoExecutionException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/DECORATION/1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd"
|
||||
name="Plugins">
|
||||
<body>
|
||||
|
||||
<menu name="Overview">
|
||||
<item name="Introduction" href="index.html"/>
|
||||
<item name="Goals" href="plugin-info.html"/>
|
||||
</menu>
|
||||
|
||||
</body>
|
||||
</project>
|
|
@ -51,6 +51,7 @@ under the License.
|
|||
<module>maven-it-plugin-fork</module>
|
||||
<module>maven-it-plugin-invalid-descriptor</module>
|
||||
<module>maven-it-plugin-log-file</module>
|
||||
<module>maven-it-plugin-model-interpolation</module>
|
||||
<module>maven-it-plugin-no-default-comp</module>
|
||||
<module>maven-it-plugin-no-project</module>
|
||||
<module>maven-it-plugin-online</module>
|
||||
|
|
Loading…
Reference in New Issue