Skip to content

Apache Lucene open-source search software

SOLR-11181: fix validate-maven-dependencies

Steve Rowe5324c7436c8b
diff --git a/build.xml b/build.xml
index f2043e20e21..5335957bea0 100755
--- a/build.xml
+++ b/build.xml
@@ -374,7 +374,23 @@
</subant>
</target>
- <target name="validate-maven-dependencies" depends="generate-maven-artifacts"
+ <target name="-install-maven-artifacts" depends="resolve,resolve-groovy,resolve-markdown,install-maven-tasks">
+ <ant dir="lucene" inheritall="false">
+ <target name="-unpack-lucene-tgz"/>
+ <target name="-filter-pom-templates"/>
+ <propertyset refid="uptodate.and.compiled.properties"/>
+ </ant>
+ <ant dir="solr" target="-unpack-solr-tgz" inheritall="false">
+ <propertyset refid="uptodate.and.compiled.properties"/>
+ </ant>
+ <subant target="-install-to-maven-local-repo" inheritall="false" failonerror="true">
+ <fileset dir="lucene" includes="build.xml" />
+ <fileset dir="solr" includes="build.xml" />
+ <propertyset refid="uptodate.and.compiled.properties"/>
+ </subant>
+ </target>
+
+ <target name="validate-maven-dependencies" depends="-install-maven-artifacts"
description="Validates maven dependencies, licenses, etc.">
<subant target="-validate-maven-dependencies" inheritall="false" failonerror="true">
<fileset dir="lucene" includes="build.xml"/>
diff --git a/lucene/analysis/build.xml b/lucene/analysis/build.xml
index 5212cd6f10a..844f5f38583 100644
--- a/lucene/analysis/build.xml
+++ b/lucene/analysis/build.xml
@@ -125,6 +125,10 @@
<forall-analyzers target="-dist-maven"/>
</target>
+ <target name="-install-to-maven-local-repo">
+ <forall-analyzers target="-install-to-maven-local-repo"/>
+ </target>
+
<target name="-validate-maven-dependencies">
<forall-analyzers target="-validate-maven-dependencies"/>
</target>
diff --git a/lucene/build.xml b/lucene/build.xml
index 9397000bb13..3aa4e42fe4a 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -428,6 +428,19 @@
</sequential>
</target>
+ <target name="-install-to-maven-local-repo" depends="install-maven-tasks">
+ <sequential>
+ <m2-install pom.xml="${filtered.pom.templates.dir}/pom.xml"/> <!-- Lucene/Solr grandparent POM -->
+ <m2-install pom.xml="${filtered.pom.templates.dir}/lucene/pom.xml"/> <!-- Lucene parent POM -->
+ <subant target="-install-to-maven-local-repo" failonerror="true" inheritall="false">
+ <propertyset refid="uptodate.and.compiled.properties"/>
+ <fileset dir="${common.dir}/core" includes="build.xml"/>
+ <fileset dir="${common.dir}/test-framework" includes="build.xml"/>
+ </subant>
+ <modules-crawl target="-install-to-maven-local-repo"/>
+ </sequential>
+ </target>
+
<target name="generate-maven-artifacts" depends="-unpack-lucene-tgz">
<ant dir=".." target="resolve" inheritall="false"/>
<antcall target="-filter-pom-templates" inheritall="false"/>
diff --git a/lucene/codecs/build.xml b/lucene/codecs/build.xml
index b1bf5acfc47..c50af6cb1b8 100644
--- a/lucene/codecs/build.xml
+++ b/lucene/codecs/build.xml
@@ -23,4 +23,6 @@
<import file="../module-build.xml"/>
<target name="-dist-maven" depends="-dist-maven-src-java"/>
+
+ <target name="-install-to-maven-local-repo" depends="-install-src-java-to-maven-local-repo"/>
</project>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 763fe8f12c9..cc0b356a7a8 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -595,7 +595,20 @@
</artifact:install>
</sequential>
</macrodef>
-
+
+ <macrodef name="m2-install" description="Installs a Maven artifact into the local repository">
+ <element name="parent-poms" optional="yes"/>
+ <attribute name="pom.xml"/>
+ <attribute name="jar.file" default="${dist.jar.dir.prefix}-${version}/${dist.jar.dir.suffix}/${final.name}.jar"/>
+ <sequential>
+ <parent-poms/>
+ <artifact:pom id="maven.project" file="@{pom.xml}"/>
+ <artifact:install file="@{jar.file}">
+ <pom refid="maven.project"/>
+ </artifact:install>
+ </sequential>
+ </macrodef>
+
<!-- validate maven dependencies -->
<macrodef name="m2-validate-dependencies">
<attribute name="pom.xml"/>
@@ -1713,6 +1726,44 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
</sequential>
</target>
+ <target name="-install-to-maven-local-repo" depends="install-maven-tasks">
+ <sequential>
+ <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>
+ <artifact:pom id="maven.project" file="${pom.xml}"/>
+ <artifact:install file="${dist.jar.dir.prefix}-${version}/${dist.jar.dir.suffix}/${final.name}.jar">
+ <pom refid="maven.project"/>
+ </artifact:install>
+ </sequential>
+ </target>
+
+ <target name="-install-src-java-to-maven-local-repo" depends="install-maven-tasks">
+ <sequential>
+ <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="*/src/java/pom.xml"/>
+ </chainedmapper>
+ </mapper>
+ <path location="${ant.file}"/>
+ </pathconvert>
+ <artifact:pom id="maven.project" file="${pom.xml}"/>
+ <artifact:install file="${dist.jar.dir.prefix}-${version}/${dist.jar.dir.suffix}/${final.name}.jar">
+ <pom refid="maven.project"/>
+ </artifact:install>
+ </sequential>
+ </target>
+
<target name="-dist-maven-src-java" depends="install-maven-tasks, jar-src, javadocs">
<sequential>
<property name="top.level.dir" location="${common.dir}/.."/>
diff --git a/lucene/core/build.xml b/lucene/core/build.xml
index 4e62e1c8616..d968798488f 100644
--- a/lucene/core/build.xml
+++ b/lucene/core/build.xml
@@ -64,6 +64,8 @@
<target name="-dist-maven" depends="-dist-maven-src-java"/>
+ <target name="-install-to-maven-local-repo" depends="-install-src-java-to-maven-local-repo"/>
+
<macrodef name="createLevAutomaton">
<attribute name="n"/>
<sequential>
diff --git a/solr/build.xml b/solr/build.xml
index 5048f1dfd72..16d4201ed8e 100644
--- a/solr/build.xml
+++ b/solr/build.xml
@@ -709,7 +709,21 @@
<contrib-crawl target="-dist-maven"/>
</sequential>
</target>
-
+
+ <target name="-install-to-maven-local-repo" depends="install-maven-tasks">
+ <sequential>
+ <m2-install pom.xml="${filtered.pom.templates.dir}/solr/pom.xml"/> <!-- Solr parent POM -->
+ <subant target="-install-to-maven-local-repo" inheritall="false">
+ <propertyset refid="uptodate.and.compiled.properties"/>
+ <fileset dir="core" includes="build.xml"/>
+ <fileset dir="solrj" includes="build.xml"/>
+ <fileset dir="test-framework" includes="build.xml"/>
+ <fileset dir="webapp" includes="build.xml"/>
+ </subant>
+ <contrib-crawl target="-install-to-maven-local-repo"/>
+ </sequential>
+ </target>
+
<target name="generate-maven-artifacts" depends="-unpack-solr-tgz">
<ant dir=".." target="resolve" inheritall="false"/>
<antcall target="-filter-pom-templates" inheritall="false"/>
diff --git a/solr/core/build.xml b/solr/core/build.xml
index af4c262dbd8..f7a2a5957b7 100644
--- a/solr/core/build.xml
+++ b/solr/core/build.xml
@@ -60,6 +60,8 @@
<target name="-dist-maven" depends="-dist-maven-src-java"/>
+ <target name="-install-to-maven-local-repo" depends="-install-src-java-to-maven-local-repo"/>
+
<target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
<sequential>
<ivy:retrieve conf="compile,compile.hadoop" type="jar,bundle" sync="${ivy.sync}" log="download-only" symlink="${ivy.symlink}"/>
diff --git a/solr/solrj/build.xml b/solr/solrj/build.xml
index 097171b283e..3393438c6e2 100644
--- a/solr/solrj/build.xml
+++ b/solr/solrj/build.xml
@@ -83,4 +83,6 @@
</target>
<target name="-dist-maven" depends="-dist-maven-src-java"/>
+
+ <target name="-install-to-maven-local-repo" depends="-install-src-java-to-maven-local-repo"/>
</project>
diff --git a/solr/webapp/build.xml b/solr/webapp/build.xml
index 2ebe084ee53..99f8d17b421 100644
--- a/solr/webapp/build.xml
+++ b/solr/webapp/build.xml
@@ -61,6 +61,9 @@
<!-- nothing to do -->
<target name="-dist-maven"/>
+ <!-- nothing to do -->
+ <target name="-install-to-maven-local-repo"/>
+
<!-- nothing to do -->
<target name="-validate-maven-dependencies"/>
</project>