You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2014/09/05 19:31:27 UTC

svn commit: r1622744 - in /lucene/dev/branches/branch_4x: ./ extra-targets.xml

Author: uschindler
Date: Fri Sep  5 17:31:27 2014
New Revision: 1622744

URL: http://svn.apache.org/r1622744
Log:
Merged revision(s) 1622743 from lucene/dev/trunk:
Better way to pass properties down to Maven: Append them to command line as real Maven properties, not as sysprops! Maven-Ant-Tasks should have support for that. By that it is now possible to override tests.multiplier, which was not possible before (pom.xml defines it so sysprop is ignored).

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/extra-targets.xml

Modified: lucene/dev/branches/branch_4x/extra-targets.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/extra-targets.xml?rev=1622744&r1=1622743&r2=1622744&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/extra-targets.xml (original)
+++ lucene/dev/branches/branch_4x/extra-targets.xml Fri Sep  5 17:31:27 2014
@@ -73,24 +73,36 @@
     <echo>You can find the merged Lucene/Solr Clover report in '${clover.report.dir}'.</echo>
   </target>
 
-  <target name="-run-maven-build" depends="install-maven-tasks">
+  <target name="-run-maven-build" depends="install-maven-tasks,resolve-groovy">
     <!-- we load all user properties from files again using a prefix, to only pass those down, not all of Ant: -->
     <property file="${user.home}/lucene.build.properties" prefix="m2userprop."/>
     <property file="${user.home}/build.properties" prefix="m2userprop."/>
     <property file="${common.dir}/build.properties" prefix="m2userprop."/>
-    <mvn xmlns="antlib:org.apache.maven.artifact.ant" pom="${maven-build-dir}/pom.xml"
-      mavenVersion="${maven-version}" failonerror="true" fork="true">
-      <arg value="-fae"/>
-      <arg value="install"/>
-      <syspropertyset>
+    <propertyset id="maven.exec.properties">
+      <propertyset>
         <propertyref prefix="m2userprop."/>
         <mapper type="glob" from="m2userprop.*" to="*"/>
-      </syspropertyset>
+      </propertyset>
       <!-- order is important: later ones override previous ones (against common Ant behaviour): -->
-      <syspropertyset>
+      <propertyset>
         <propertyref builtin="commandline"/>
-      </syspropertyset>
-    </mvn>
+      </propertyset>
+    </propertyset>
+    <!-- execute Maven using maven-ant-tasks, passing all collected properties as -D args: -->
+    <groovy><![CDATA[
+      import groovy.xml.NamespaceBuilder;
+      def pomFile = properties['maven-build-dir']+'/pom.xml';
+      def artifact = NamespaceBuilder.newInstance(ant, 'antlib:org.apache.maven.artifact.ant');
+      artifact.mvn(pom:pomFile, mavenVersion:properties['maven-version'], failonerror:true, fork:true) {
+        project.getReference('maven.exec.properties').properties.each { k, v ->
+          if (!k.startsWith('ant.')) { // filter internal ant properties
+            arg(value: '-D' + k + '=' + v);
+          }
+        };
+        arg(value:'-fae');
+        arg(value:'install');
+      };
+    ]]></groovy>
   </target>
 
   <target name="-check-svn-working-copy" depends="ivy-availability-check,ivy-fail,ivy-configure,resolve-groovy">