You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2013/03/10 22:23:10 UTC

git commit: fix it with no more dependency on an external mojo.

Updated Branches:
  refs/heads/master f8ec519b7 -> c9eecc8f0


fix it with no more dependency on an external mojo.

Submitted by Stuart McCulloch


Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/c9eecc8f
Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/c9eecc8f
Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/c9eecc8f

Branch: refs/heads/master
Commit: c9eecc8f0c220da665a448d5f3579f533b03119f
Parents: f8ec519
Author: olivier lamy <ol...@apache.org>
Authored: Sun Mar 10 22:22:14 2013 +0100
Committer: olivier lamy <ol...@apache.org>
Committed: Sun Mar 10 22:22:14 2013 +0100

----------------------------------------------------------------------
 ...445LegacyStringSearchModelInterpolatorTest.java |    7 +-
 core-it-suite/src/test/resources/mng-5445/pom.xml  |   27 ++-----
 .../maven-it-plugin-model-interpolation/pom.xml    |   65 +++++++++++++++
 .../maven/plugin/coreit/PathInterpolationMojo.java |   57 +++++++++++++
 .../src/site/site.xml                              |   33 ++++++++
 core-it-support/core-it-plugins/pom.xml            |    1 +
 6 files changed, 166 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c9eecc8f/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java
index b55d97d..e00714b 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5445LegacyStringSearchModelInterpolatorTest.java
@@ -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,)" );
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c9eecc8f/core-it-suite/src/test/resources/mng-5445/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-suite/src/test/resources/mng-5445/pom.xml b/core-it-suite/src/test/resources/mng-5445/pom.xml
index f05e533..5ba7630 100644
--- a/core-it-suite/src/test/resources/mng-5445/pom.xml
+++ b/core-it-suite/src/test/resources/mng-5445/pom.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c9eecc8f/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml b/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml
new file mode 100644
index 0000000..1ec7577
--- /dev/null
+++ b/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/pom.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c9eecc8f/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java
----------------------------------------------------------------------
diff --git a/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java b/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java
new file mode 100644
index 0000000..dc86b3f
--- /dev/null
+++ b/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/main/java/org/apache/maven/plugin/coreit/PathInterpolationMojo.java
@@ -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 );
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c9eecc8f/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/site/site.xml
----------------------------------------------------------------------
diff --git a/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/site/site.xml b/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/site/site.xml
new file mode 100644
index 0000000..18f84c5
--- /dev/null
+++ b/core-it-support/core-it-plugins/maven-it-plugin-model-interpolation/src/site/site.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/c9eecc8f/core-it-support/core-it-plugins/pom.xml
----------------------------------------------------------------------
diff --git a/core-it-support/core-it-plugins/pom.xml b/core-it-support/core-it-plugins/pom.xml
index 76ae364..54ce6a8 100644
--- a/core-it-support/core-it-plugins/pom.xml
+++ b/core-it-support/core-it-plugins/pom.xml
@@ -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>