Index: modules/grouping/build.xml
===================================================================
--- modules/grouping/build.xml	(revision 1309129)
+++ modules/grouping/build.xml	(working copy)
@@ -40,7 +40,6 @@
       <path refid="base.classpath"/>
     </path>
 
-    <target name="dist-maven" depends="jar-core,javadocs,common.dist-maven" />
     <target name="compile" depends="jar-queries,common.compile-core" description="Compiles facet classes" />
     <target name="jar-core" depends="common.jar-core" />
 
Index: modules/queries/build.xml
===================================================================
--- modules/queries/build.xml	(revision 1309129)
+++ modules/queries/build.xml	(working copy)
@@ -25,6 +25,4 @@
   <property name="maven.dist.dir" location="../dist/maven"/>
 
   <import file="../../lucene/contrib/contrib-build.xml"/>
-
-  <target name="dist-maven" depends="jar-core,javadocs,common.dist-maven"/>
 </project>
\ No newline at end of file
Index: modules/join/build.xml
===================================================================
--- modules/join/build.xml	(revision 1309129)
+++ modules/join/build.xml	(working copy)
@@ -21,6 +21,4 @@
   </path>
 
   <target name="init" depends="contrib-build.init,jar-grouping"/>
-
-  <target name="dist-maven" depends="jar-core,javadocs,common.dist-maven" />
 </project>
Index: modules/suggest/build.xml
===================================================================
--- modules/suggest/build.xml	(revision 1309129)
+++ modules/suggest/build.xml	(working copy)
@@ -28,6 +28,4 @@
   <property name="maven.dist.dir" location="../dist/maven" />
 
   <import file="../../lucene/contrib/contrib-build.xml"/>
-
-  <target name="dist-maven" depends="jar-core,javadocs,common.dist-maven" />
 </project>
Index: modules/queryparser/build.xml
===================================================================
--- modules/queryparser/build.xml	(revision 1309129)
+++ modules/queryparser/build.xml	(working copy)
@@ -34,8 +34,6 @@
 
   <target name="compile-core" depends="jar-queries,jar-sandbox,common.compile-core"/>
 
-  <target name="dist-maven" depends="jar-core,javadocs,common.dist-maven"/>
-
   <target name="javacc" depends="init,javacc-check,javacc-QueryParser,javacc-surround,javacc-flexible"/>
 
   <target name="javacc-QueryParser" depends="init,javacc-check" if="javacc.present">
Index: lucene/common-build.xml
===================================================================
--- lucene/common-build.xml	(revision 1309129)
+++ lucene/common-build.xml	(working copy)
@@ -196,6 +196,8 @@
   <property name="gpg.exe" value="gpg" />
   <property name="gpg.key" value="CODE SIGNING KEY" />
 
+  <property name="filtered.pom.templates.dir" location="${common.dir}/build/poms"/>
+
   <property name="clover.db.dir" location="${common.dir}/build/test/clover/db"/>
   <property name="clover.report.dir" location="${common.dir}/build/test/clover/reports"/>
 
@@ -399,7 +401,7 @@
 
   <macrodef name="m2-deploy" description="Builds a Maven artifact">
   	<element name="artifact-attachments" optional="yes"/>
-    <attribute name="pom.xml" default="pom.xml"/>
+    <attribute name="pom.xml"/>
     <attribute name="jar.file" default="${build.dir}/${final.name}.jar"/>
     <sequential>
       <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
@@ -844,10 +846,23 @@
              uri="antlib:org.apache.maven.artifact.ant" 
              classpathref="maven-ant-tasks.classpath"/>
   </target>
-  
-  <target name="dist-maven" if="pom.xml.present" depends="jar-core, jar-src, javadocs, install-maven-tasks">
+
+  <target name="dist-maven"
+          depends="filter-pom-templates, install-maven-tasks, m2-deploy-lucene-parent-pom, dist-maven-common"/>
+  <target name="dist-maven-common"
+          depends="jar-core, jar-src, javadocs, install-maven-tasks, filter-pom-templates">
     <sequential>
-      <m2-deploy>
+      <property name="top.level.dir" location="${common.dir}/.."/>
+      <pathconvert property="pom.xml">
+        <mapper>
+          <chainedmapper>
+            <globmapper from="${top.level.dir}*" to="${filtered.pom.templates.dir}*"/>
+            <globmapper from="*build.xml" to="*pom.xml"/>
+          </chainedmapper>
+        </mapper>
+        <path location="${ant.file}"/>
+      </pathconvert>
+      <m2-deploy pom.xml="${pom.xml}">
         <artifact-attachments>
           <attach file="${build.dir}/${final.name}-src.jar"
                   classifier="sources"/>
@@ -858,6 +873,30 @@
     </sequential>
   </target>
 
+  <target name="filter-pom-templates" unless="filtered.pom.templates.uptodate">
+    <mkdir dir="${filtered.pom.templates.dir}"/>
+    <copy todir="${common.dir}/build/poms" overwrite="true">
+      <fileset dir="${common.dir}/../dev-tools/maven"/>
+      <filterset begintoken="@" endtoken="@">
+        <filter token="version" value="${version}"/>
+      </filterset>
+      <globmapper from="*.template" to="*"/>
+    </copy>
+    <property name="filtered.pom.templates.uptodate" value="true"/>
+  </target>
+
+  <target name="m2-deploy-lucene-parent-pom" depends="filter-pom-templates,m2-deploy-grandparent-pom"
+          unless="deployed.lucene.parent.pom.uptodate">
+    <m2-deploy pom.xml="${filtered.pom.templates.dir}/lucene/pom.xml"/>    <!-- Lucene parent POM -->
+    <property name="deployed.lucene.parent.pom.uptodate" value="true"/>
+  </target>
+
+  <target name="m2-deploy-grandparent-pom" depends="filter-pom-templates"
+          unless="deployed.grandparent.pom.uptodate">
+    <m2-deploy pom.xml="${filtered.pom.templates.dir}/pom.xml"/>    <!-- Lucene/Solr grandparent POM -->
+    <property name="deployed.grandparent.pom.uptodate" value="true"/>
+  </target>
+
   <target name="rat-sources-typedef">
     <typedef resource="org/apache/rat/anttasks/antlib.xml" uri="antlib:rat.anttasks">
       <classpath>
Index: lucene/CHANGES.txt
===================================================================
--- lucene/CHANGES.txt	(revision 1309129)
+++ lucene/CHANGES.txt	(working copy)
@@ -1065,7 +1065,12 @@
 * LUCENE-3762: Upgrade JUnit to 4.10, refactor state-machine of detecting 
   setUp/tearDown call chaining in LuceneTestCase. (Dawid Weiss, Robert Muir)
 
+* LUCENE-3944: Make the 'generate-maven-artifacts' target use filtered POMs
+  placed under lucene/build/poms/, rather than in each module's base
+  directory.  The 'clean' target now removes them.
+  (Steve Rowe, Robert Muir)
 
+
 ======================= Lucene 3.5.0 =======================
 
 Changes in backwards compatibility policy
Index: lucene/build.xml
===================================================================
--- lucene/build.xml	(revision 1309129)
+++ lucene/build.xml	(working copy)
@@ -450,13 +450,9 @@
   </target>
 
 
-  <target name="generate-maven-artifacts" depends="install-maven-tasks, package, javadocs">
+  <target name="generate-maven-artifacts"
+          depends="install-maven-tasks, filter-pom-templates, package, javadocs">
     <sequential>
-	  <ant target="get-maven-poms" dir=".."/>
- 
-      <m2-deploy pom.xml="../pom.xml"/> <!-- Lucene/Solr grandparent POM -->
-      <m2-deploy pom.xml="pom.xml"/>    <!-- Lucene parent POM -->
-      
       <subant target="dist-maven" failonerror="true" inheritall="false">
         <propertyset refid="uptodate.and.compiled.properties"/>
         <fileset dir="${common.dir}/core" includes="build.xml"/>
Index: build.xml
===================================================================
--- build.xml	(revision 1309129)
+++ build.xml	(working copy)
@@ -77,13 +77,16 @@
     </copy>
   </target>
 
-  <target name="generate-maven-artifacts" description="Generate Maven Artifacts for Lucene and Solr">
+  <target name="generate-maven-artifacts"
+          description="Generate Maven Artifacts for Lucene and Solr">
     <property name="maven.dist.dir"  location="dist/maven" />
     <mkdir dir="${maven.dist.dir}" />
 
     <sequential>
+      <ant dir="lucene" target="filter-pom-templates"/>
       <subant target="generate-maven-artifacts" inheritall="false" failonerror="true">
         <property name="maven.dist.dir"  location="${maven.dist.dir}" />
+        <property name="filtered.pom.templates.uptodate" value="true"/>
         <fileset dir="lucene" includes="build.xml" />
         <fileset dir="modules" includes="build.xml" />
         <fileset dir="solr" includes="build.xml" />
Index: solr/build.xml
===================================================================
--- solr/build.xml	(revision 1309129)
+++ solr/build.xml	(working copy)
@@ -537,8 +537,6 @@
  
   <target name="generate-maven-artifacts" depends="install-maven-tasks">
     <sequential>
-      <ant target="get-maven-poms" dir=".." inheritall="false"/>
-      <m2-deploy pom.xml="pom.xml"/> <!-- Solr parent POM -->
       <subant target="dist-maven" inheritall="false" >
         <fileset dir="core" includes="build.xml"/>
         <fileset dir="solrj" includes="build.xml"/>
Index: solr/contrib/langid/build.xml
===================================================================
--- solr/contrib/langid/build.xml	(revision 1309129)
+++ solr/contrib/langid/build.xml	(working copy)
@@ -32,7 +32,7 @@
   </path>
 
   <dirname file="${ant.file.solr-langid}" property="solr-langid.dir"/>
-  <target name="dist-maven" depends="jar-core,javadocs,jar-src,common.dist-maven">
+  <target name="dist-maven" depends="common-solr.dist-maven">
     <m2-deploy-with-pom-template pom.xml="${solr-langid.dir}/lib/langdetect-pom.xml.template"
                                  jar.file="${solr-langid.dir}/lib/langdetect-c51112119be53a81e59706ce57bacaa90c052284.jar" />
   </target>
Index: solr/webapp/build.xml
===================================================================
--- solr/webapp/build.xml	(revision 1309129)
+++ solr/webapp/build.xml	(working copy)
@@ -69,7 +69,8 @@
     </war>
   </target>
 
-  <target name="dist-maven" depends="dist" if="pom.xml.present">
-    <m2-deploy jar.file="${dist}/apache-solr-${version}.war"/>
+  <target name="dist-maven" depends="dist, filter-pom-templates, install-maven-tasks, m2-deploy-solr-parent-pom">
+    <m2-deploy jar.file="${dist}/apache-solr-${version}.war"
+               pom.xml="${filtered.pom.templates.dir}/solr/webapp/pom.xml"/>
   </target>
 </project>
Index: solr/common-build.xml
===================================================================
--- solr/common-build.xml	(revision 1309129)
+++ solr/common-build.xml	(working copy)
@@ -237,6 +237,15 @@
   	<solr-jarify basedir="${src.dir}" destfile="${build.dir}/${final.name}-src.jar"/>
   </target>
 
+  <target name="m2-deploy-solr-parent-pom" depends="filter-pom-templates"
+          unless="deployed.solr.parent.pom.uptodate">
+    <m2-deploy pom.xml="${filtered.pom.templates.dir}/solr/pom.xml"/>    <!-- Solr parent POM -->
+    <property name="deployed.solr.parent.pom.uptodate" value="true"/>
+  </target>
+
+  <target name="dist-maven"
+          depends="filter-pom-templates, install-maven-tasks, m2-deploy-solr-parent-pom, dist-maven-common"/>
+
   <!-- Solr core targets -->
   <target name="compile-solr-core" description="Compile Solr core." unless="solr.core.compiled">
     <ant dir="${common-solr.dir}/core" target="compile-core" inheritAll="false">
