Apache Solr open-source search software
SOLR-7227: Don't create the WAR file at all
Uwe Schindler3e406606ed8c
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.pyindex 11d0ddebdfc..fbeb94e7a53 100644--- a/dev-tools/scripts/smokeTestRelease.py+++ b/dev-tools/scripts/smokeTestRelease.py@@ -168,88 +168,68 @@ LICENSE_FILE_NAME = 'META-INF/LICENSE.txt'def checkJARMetaData(desc, jarFile, svnRevision, version):- s = None- notice = None- license = None-- # support expanded WAR directory or JAR file- if isinstance(jarFile, str) and os.path.isdir(jarFile):+ with zipfile.ZipFile(jarFile, 'r') as z:for name in (MANIFEST_FILE_NAME, NOTICE_FILE_NAME, LICENSE_FILE_NAME):- if not os.path.isfile(jarFile + '/' + name):- raise RuntimeError('%s is missing %s' % (desc, name))-- s = open(jarFile + '/' + MANIFEST_FILE_NAME,encoding='UTF-8').read()- notice = open(jarFile + '/' + NOTICE_FILE_NAME,encoding='UTF-8').read()- license = open(jarFile + '/' + LICENSE_FILE_NAME,encoding='UTF-8').read()-- else:- with zipfile.ZipFile(jarFile, 'r') as z:- for name in (MANIFEST_FILE_NAME, NOTICE_FILE_NAME, LICENSE_FILE_NAME):- try:- # The Python docs state a KeyError is raised ... so this None- # check is just defensive:- if z.getinfo(name) is None:- raise RuntimeError('%s is missing %s' % (desc, name))- except KeyError:+ try:+ # The Python docs state a KeyError is raised ... so this None+ # check is just defensive:+ if z.getinfo(name) is None:raise RuntimeError('%s is missing %s' % (desc, name))-- s = decodeUTF8(z.read(MANIFEST_FILE_NAME))- notice = decodeUTF8(z.read(NOTICE_FILE_NAME))- license = decodeUTF8(z.read(LICENSE_FILE_NAME))-+ except KeyError:+ raise RuntimeError('%s is missing %s' % (desc, name))++ s = decodeUTF8(z.read(MANIFEST_FILE_NAME))- for verify in (- 'Specification-Vendor: The Apache Software Foundation',- 'Implementation-Vendor: The Apache Software Foundation',- # Make sure 1.8 compiler was used to build release bits:- 'X-Compile-Source-JDK: 1.8',- # Make sure 1.8 ant was used to build release bits: (this will match 1.8+)- 'Ant-Version: Apache Ant 1.8',- # Make sure .class files are 1.8 format:- 'X-Compile-Target-JDK: 1.8',- 'Specification-Version: %s' % version,- # Make sure the release was compiled with 1.8:- 'Created-By: 1.8'):- if s.find(verify) == -1:- raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFEST.MF' % \- (desc, verify))-- if svnRevision != 'skip':- # Make sure this matches the version and svn revision we think we are releasing:- verifyRevision = 'Implementation-Version: %s %s ' % (version, svnRevision)- if s.find(verifyRevision) == -1:- raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFEST.MF (wrong svn revision?)' % \+ for verify in (+ 'Specification-Vendor: The Apache Software Foundation',+ 'Implementation-Vendor: The Apache Software Foundation',+ # Make sure 1.8 compiler was used to build release bits:+ 'X-Compile-Source-JDK: 1.8',+ # Make sure 1.8 ant was used to build release bits: (this will match 1.8+)+ 'Ant-Version: Apache Ant 1.8',+ # Make sure .class files are 1.8 format:+ 'X-Compile-Target-JDK: 1.8',+ 'Specification-Version: %s' % version,+ # Make sure the release was compiled with 1.8:+ 'Created-By: 1.8'):+ if s.find(verify) == -1:+ raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFEST.MF' % \+ (desc, verify))++ if svnRevision != 'skip':+ # Make sure this matches the version and svn revision we think we are releasing:+ verifyRevision = 'Implementation-Version: %s %s ' % (version, svnRevision)+ if s.find(verifyRevision) == -1:+ raise RuntimeError('%s is missing "%s" inside its META-INF/MANIFEST.MF (wrong svn revision?)' % \(desc, verifyRevision))- idx = desc.find('inside WAR file')- if idx != -1:- desc2 = desc[:idx]- else:- desc2 = desc+ notice = decodeUTF8(z.read(NOTICE_FILE_NAME))+ license = decodeUTF8(z.read(LICENSE_FILE_NAME))- justFileName = os.path.split(desc2)[1]- if justFileName.lower().find('solr') != -1 or justFileName.lower().find('webapp') != -1:- if SOLR_LICENSE is None:- raise RuntimeError('BUG in smokeTestRelease!')- if SOLR_NOTICE is None:- raise RuntimeError('BUG in smokeTestRelease!')- if notice != SOLR_NOTICE:- raise RuntimeError('%s: %s contents doesn\'t match main NOTICE.txt' % \- (desc, NOTICE_FILE_NAME))- if license != SOLR_LICENSE:- raise RuntimeError('%s: %s contents doesn\'t match main LICENSE.txt' % \- (desc, LICENSE_FILE_NAME))- else:- if LUCENE_LICENSE is None:- raise RuntimeError('BUG in smokeTestRelease!')- if LUCENE_NOTICE is None:- raise RuntimeError('BUG in smokeTestRelease!')- if notice != LUCENE_NOTICE:- raise RuntimeError('%s: %s contents doesn\'t match main NOTICE.txt' % \- (desc, NOTICE_FILE_NAME))- if license != LUCENE_LICENSE:- raise RuntimeError('%s: %s contents doesn\'t match main LICENSE.txt' % \- (desc, LICENSE_FILE_NAME))+ justFileName = os.path.split(desc)[1]++ if justFileName.lower().find('solr') != -1:+ if SOLR_LICENSE is None:+ raise RuntimeError('BUG in smokeTestRelease!')+ if SOLR_NOTICE is None:+ raise RuntimeError('BUG in smokeTestRelease!')+ if notice != SOLR_NOTICE:+ raise RuntimeError('%s: %s contents doesn\'t match main NOTICE.txt' % \+ (desc, NOTICE_FILE_NAME))+ if license != SOLR_LICENSE:+ raise RuntimeError('%s: %s contents doesn\'t match main LICENSE.txt' % \+ (desc, LICENSE_FILE_NAME))+ else:+ if LUCENE_LICENSE is None:+ raise RuntimeError('BUG in smokeTestRelease!')+ if LUCENE_NOTICE is None:+ raise RuntimeError('BUG in smokeTestRelease!')+ if notice != LUCENE_NOTICE:+ raise RuntimeError('%s: %s contents doesn\'t match main NOTICE.txt' % \+ (desc, NOTICE_FILE_NAME))+ if license != LUCENE_LICENSE:+ raise RuntimeError('%s: %s contents doesn\'t match main LICENSE.txt' % \+ (desc, LICENSE_FILE_NAME))def normSlashes(path):return path.replace(os.sep, '/')@@ -291,46 +271,6 @@ def checkAllJARs(topDir, project, svnRevision, version, tmpDir, baseURL):% (fullPath, luceneDistFilenames[jarFilename]))-def checkSolrWAR(warFileName, svnRevision, version, tmpDir, baseURL):-- """- Crawls for JARs inside the WAR and ensures there are no classes- under java.* or javax.* namespace.- """-- print(' verify WAR metadata/contained JAR identity/no javax.* or java.* classes...')-- checkJARMetaData(warFileName, warFileName, svnRevision, version)-- distFilenames = dict()- for file in getBinaryDistFiles('lucene', tmpDir, version, baseURL):- distFilenames[os.path.basename(file)] = file-- for (dirpath, subdirs, files) in os.walk(warFileName):- for name in files:- if name.endswith('.jar'):- path = os.path.join(dirpath, name)- jarInsideWarContents = open(path, 'rb').read()- noJavaPackageClasses('JAR file %s inside WAR file %s' % (name, warFileName),- io.BytesIO(jarInsideWarContents))- if name.lower().find('lucene') != -1 or name.lower().find('solr') != -1:- checkJARMetaData('JAR file %s inside WAR file %s' % (name, warFileName),- io.BytesIO(jarInsideWarContents),- svnRevision,- version)- if name.lower().find('lucene') != -1:- jarInsideWarFilename = os.path.basename(name)- if jarInsideWarFilename not in distFilenames:- raise RuntimeError('Artifact %s in %s is not present in Lucene binary distribution'- % (name, warFileName))- distJarName = distFilenames[jarInsideWarFilename]- with open(distJarName, "rb", buffering=0) as distJarFile:- distJarContents = distJarFile.readall()- if jarInsideWarContents != distJarContents:- raise RuntimeError('Artifact %s in %s is not identical to %s in Lucene binary distribution'- % (name, warFileName, distJarName))--def checkSigs(project, urlString, version, tmpDir, isSigned):print(' test basics...')@@ -770,8 +710,6 @@ def verifyUnpacked(java, project, artifact, unpackPath, svnRevision, version, techeckJavadocpath('%s/docs' % unpackPath)else:- checkSolrWAR('%s/server/solr-webapp/webapp' % unpackPath, svnRevision, version, tmpDir, baseURL)-print(' copying unpacked distribution for Java 8 ...')java8UnpackPath = '%s-java8' % unpackPathif os.path.exists(java8UnpackPath):diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex a9805e6ba46..5cc4364cf9c 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -366,8 +366,9 @@ Other Changes* SOLR-7735: Look for solr.xml in Zookeeper by default in SolrCloud mode. If not found, it will be loadedfrom $SOLR_HOME/solr.xml as before. Sysprop solr.solrxml.location is now gone. (janhoy)-* SOLR-7227: Ship Solr with the Web application directory exploded into server/solr-webapp,- solr.war is no longer included in the distribution bundles. (Timothy Potter)+* SOLR-7227: Ship Solr with the Web application directory exploded into+ server/solr-webapp, solr.war is no longer included in the distribution+ bundles. (Timothy Potter, Uwe Schindler)================== 5.2.1 ==================diff --git a/solr/build.xml b/solr/build.xmlindex 7c1e790012f..4916309f261 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -42,8 +42,11 @@<!-- ============================== USER TASKS =============================== --><!-- ========================================================================= -->- <target name="server" depends="dist-contrib,server-war"+ <target name="server" depends="dist-contrib"description="Creates a Solr server">+ <ant dir="webapp" target="dist" inheritall="false">+ <propertyset refid="uptodate.and.compiled.properties"/>+ </ant><jar destfile="${example}/exampledocs/post.jar"basedir="${dest}/solr-core/classes/java"includes="org/apache/solr/util/SimplePostTool*.class">@@ -409,13 +412,6 @@<contrib-crawl target="dist" failonerror="true" /></target>- <target name="server-war"- description="Creates the Solr WAR Distribution file.">- <ant dir="webapp" target="server-war" inheritall="false">- <propertyset refid="uptodate.and.compiled.properties"/>- </ant>- </target>-<target name="prepare-release-no-sign" depends="clean, package, generate-maven-artifacts"/><target name="prepare-release" depends="prepare-release-no-sign, sign-artifacts"/>@@ -486,7 +482,7 @@<tarfileset dir="." prefix="${fullnamever}" includes="LICENSE.txt NOTICE.txt"/><tarfileset dir="." prefix="${fullnamever}/solr"excludes="build/** ${package.dir.rel}/** ${dist.rel}/**- server/webapps/*.war example/lib/**+ example/lib/****/*.jarlib/README.committers.txt **/data/ **/logs/***/*.sh **/bin/ scripts/diff --git a/solr/common-build.xml b/solr/common-build.xmlindex 337caa9c148..892b2286b9d 100644--- a/solr/common-build.xml+++ b/solr/common-build.xml@@ -488,10 +488,10 @@<contrib-crawl target="jar-core"/></target>- <target name="contribs-add-to-war">+ <target name="contribs-add-to-webapp"><mkdir dir="${dest}/web"/><delete dir="${dest}/web" includes="**/*" failonerror="false"/>- <contrib-crawl target="add-to-war"/>+ <contrib-crawl target="add-to-webapp"/></target><!-- Forbidden API Task, customizations for Solr -->diff --git a/solr/contrib/contrib-build.xml b/solr/contrib/contrib-build.xmlindex 3f4ce272934..6a3fb1177fd 100644--- a/solr/contrib/contrib-build.xml+++ b/solr/contrib/contrib-build.xml@@ -30,7 +30,7 @@<dirname file="${ant.file}" property="antfile.dir"/><available property="contrib.has.webapp" type="dir" file="${antfile.dir}/src/webapp" />- <target name="add-to-war" if="contrib.has.webapp">+ <target name="add-to-webapp" if="contrib.has.webapp"><copy todir="${dest}/web" failonerror="false"><fileset dir="${antfile.dir}/src/webapp"/></copy>diff --git a/solr/server/contexts/solr-jetty-context.xml b/solr/server/contexts/solr-jetty-context.xmlindex 5bf2d9a1400..6392cd11b74 100644--- a/solr/server/contexts/solr-jetty-context.xml+++ b/solr/server/contexts/solr-jetty-context.xml@@ -4,4 +4,5 @@<Set name="contextPath"><Property name="hostContext" default="/solr"/></Set><Set name="war"><Property name="jetty.base"/>/solr-webapp/webapp</Set><Set name="defaultsDescriptor"><Property name="jetty.base"/>/etc/webdefault.xml</Set>+ <Set name="extractWAR">false</Set></Configure>diff --git a/solr/webapp/build.xml b/solr/webapp/build.xmlindex cca513b66ae..3843d92e7d6 100644--- a/solr/webapp/build.xml+++ b/solr/webapp/build.xml@@ -23,13 +23,8 @@<import file="../common-build.xml"/>- <property name="exclude.from.war" value="*slf4j*,log4j-*" />- <property name="solr.war.suffix" value="" />+ <property name="exclude.from.webapp" value="*slf4j*,log4j-*" />- <target name="test" depends="compile-test-solr-core">- <!-- no more JSP -->- </target>-<!-- this module has no javadocs --><target name="javadocs"/>@@ -39,36 +34,27 @@<!-- nothing to compile --><target name="compile-core"/><target name="compile-test"/>+ <target name="test"/>- <target name="server-war"- description="Creates the Solr WAR Distribution file."- depends="test, init-dist, dist-core, dist-solrj, lucene-jars-to-solr">- <build-manifest title="Apache Solr Search Server"- implementation.title="org.apache.solr"/>- <ant dir="${common-solr.dir}" inheritall="false" target="contribs-add-to-war"/>- <mkdir dir="${server.dir}/webapps"/>- <war destfile="${server.dir}/webapps/solr.war"- webxml="web/WEB-INF/web.xml"- manifest="${manifest.file}">- <lib dir="${common-solr.dir}/core/lib" excludes="${exclude.from.war},${common.classpath.excludes}"/>- <lib dir="${common-solr.dir}/solrj/lib" excludes="${exclude.from.war},${common.classpath.excludes}"/>- <lib dir="${lucene-libs}" excludes="${exclude.from.war},${common.classpath.excludes}" />- <lib dir="${dist}" excludes="${exclude.from.war},${common.classpath.excludes}">+ <target name="dist"+ description="Creates the Webapp folder for distribution."+ depends="dist-core, dist-solrj, lucene-jars-to-solr">+ <ant dir="${common-solr.dir}" inheritall="false" target="contribs-add-to-webapp"/>+ <mkdir dir="${server.dir}/solr-webapp/webapp"/>+ <copy todir="${server.dir}/solr-webapp/webapp">+ <fileset dir="web" excludes="${exclude.from.webapp}"/>+ <fileset dir="${dest}/web" excludes="${exclude.from.war}"/> <!-- contribs' additions -->+ </copy>+ <mkdir dir="${server.dir}/solr-webapp/webapp/WEB-INF/lib"/>+ <copy todir="${server.dir}/solr-webapp/webapp/WEB-INF/lib">+ <fileset dir="${common-solr.dir}/core/lib" excludes="${exclude.from.webapp},${common.classpath.excludes}"/>+ <fileset dir="${common-solr.dir}/solrj/lib" excludes="${exclude.from.webapp},${common.classpath.excludes}"/>+ <fileset dir="${lucene-libs}" excludes="${exclude.from.webapp},${common.classpath.excludes}" />+ <fileset dir="${dist}" excludes="${exclude.from.webapp},${common.classpath.excludes}"><include name="solr-solrj-${version}.jar" /><include name="solr-core-${version}.jar" />- </lib>- <fileset dir="${dest}/web" excludes="${exclude.from.war}"/> <!-- contribs' additions -->- <fileset dir="web" excludes="${exclude.from.war}"/>- <metainf dir="${common-solr.dir}" includes="LICENSE.txt,NOTICE.txt" excludes="${exclude.from.war}"/>- </war>-- <!-- Ship Solr with the WAR already extracted -->- <delete dir="${server.dir}/solr-webapp/webapp"/>- <mkdir dir="${server.dir}/solr-webapp/webapp"/>- <unzip dest="${server.dir}/solr-webapp/webapp" src="${server.dir}/webapps/solr.war"/>- <delete file="${server.dir}/webapps/solr.war"/>- <delete dir="${server.dir}/webapps"/>-+ </fileset>+ </copy></target><!-- nothing to do -->