maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject [maven-ant-plugin] 31/50: MANT-18: added Maven Project properties in the maven-build.properties
Date Wed, 20 Dec 2017 09:26:49 GMT
This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to annotated tag maven-ant-plugin-2.0
in repository https://gitbox.apache.org/repos/asf/maven-ant-plugin.git

commit 68adbe6091acd52b6b49da68326b13a245dac9f3
Author: Vincent Siveton <vsiveton@apache.org>
AuthorDate: Mon Sep 25 11:42:19 2006 +0000

    MANT-18: added Maven Project properties in the maven-build.properties
    
    o Store Maven project properties
    o updated test case
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-ant-plugin@449658
13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/maven/plugin/ant/AntBuildWriter.java   | 14 ++++++++++++++
 .../maven/plugin/ant/stubs/AntTestMavenProjectStub.java    |  9 +++++++++
 .../resources/unit/ant-test/ant-test-plugin-config.xml     |  3 +++
 3 files changed, 26 insertions(+)

diff --git a/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java b/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
index 55f7426..0c3df2f 100644
--- a/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
+++ b/src/main/java/org/apache/maven/plugin/ant/AntBuildWriter.java
@@ -27,6 +27,7 @@ import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.maven.artifact.Artifact;
@@ -195,6 +196,19 @@ public class AntBuildWriter
         addProperty( properties, "maven.settings.interactiveMode", String.valueOf( settings.isInteractiveMode()
) );
         addProperty( properties, "maven.repo.local", localRepository.getAbsolutePath() );
 
+        // ----------------------------------------------------------------------
+        // Project properties
+        // ----------------------------------------------------------------------
+
+        if ( project.getProperties() != null )
+        {
+            for ( Iterator it = project.getProperties().entrySet().iterator(); it.hasNext();
)
+            {
+                Map.Entry property = (Map.Entry) it.next();
+                addProperty( properties, property.getKey().toString(), property.getValue().toString()
);
+            }
+        }
+
         properties.store( os, "Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE!" );
     }
 
diff --git a/src/test/java/org/apache/maven/plugin/ant/stubs/AntTestMavenProjectStub.java
b/src/test/java/org/apache/maven/plugin/ant/stubs/AntTestMavenProjectStub.java
index 6a5f381..fad53af 100644
--- a/src/test/java/org/apache/maven/plugin/ant/stubs/AntTestMavenProjectStub.java
+++ b/src/test/java/org/apache/maven/plugin/ant/stubs/AntTestMavenProjectStub.java
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.FileReader;
 import java.util.Collections;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.DefaultArtifact;
@@ -168,4 +169,12 @@ public class AntTestMavenProjectStub
 
         return Collections.singletonList( repo );
     }
+
+    /**
+     * @see org.apache.maven.project.MavenProject#getProperties()
+     */
+    public Properties getProperties()
+    {
+        return getModel().getProperties();
+    }
 }
diff --git a/src/test/resources/unit/ant-test/ant-test-plugin-config.xml b/src/test/resources/unit/ant-test/ant-test-plugin-config.xml
index 1c51725..14c7a55 100644
--- a/src/test/resources/unit/ant-test/ant-test-plugin-config.xml
+++ b/src/test/resources/unit/ant-test/ant-test-plugin-config.xml
@@ -48,4 +48,7 @@
       </plugin>
     </plugins>
   </build>
+  <properties>
+    <myKey>myValue</myKey>
+  </properties>
 </project>

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <commits@maven.apache.org>.

Mime
View raw message