Apache Lucene open-source search software
SOLR-7227: Solr distribution archive should have the WAR file extracted already
Timothy Potter2eb704ef5012
diff --git a/build.xml b/build.xmlindex e1d9a5b759d..96265d725df 100644--- a/build.xml+++ b/build.xml@@ -296,7 +296,7 @@<fileset dir="${basedir}/lucene" includes="**/lib/*.jar"excludes="**/*servlet-api*.jar, analysis/uima/**, tools/**, build/**"/><fileset dir="${basedir}/solr" includes="**/test-lib/*.jar,**/lib/*.jar"- excludes="core/test-lib/*servlet-api*.jar, contrib/analysis-extras/**, test-framework/lib/junit*, test-framework/lib/ant*, test-framework/lib/randomizedtesting*, build/**, dist/**, package/**, example/solr-webapp/**" />+ excludes="core/test-lib/*servlet-api*.jar, contrib/analysis-extras/**, test-framework/lib/junit*, test-framework/lib/ant*, test-framework/lib/randomizedtesting*, build/**, dist/**, package/**, server/solr-webapp/**" /><map from="${basedir}/" to=""/></pathconvert><mkdir dir="nbproject"/>diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.pyindex 09a479619fc..11d0ddebdfc 100644--- a/dev-tools/scripts/smokeTestRelease.py+++ b/dev-tools/scripts/smokeTestRelease.py@@ -168,74 +168,88 @@ LICENSE_FILE_NAME = 'META-INF/LICENSE.txt'def checkJARMetaData(desc, jarFile, svnRevision, version):- with zipfile.ZipFile(jarFile, 'r') as z:+ s = None+ notice = None+ license = None++ # support expanded WAR directory or JAR file+ if isinstance(jarFile, str) and os.path.isdir(jarFile):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:+ if not os.path.isfile(jarFile + '/' + name):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?)' % \- (desc, verifyRevision))- notice = decodeUTF8(z.read(NOTICE_FILE_NAME))- license = decodeUTF8(z.read(LICENSE_FILE_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()- idx = desc.find('inside WAR file')- if idx != -1:- desc2 = desc[:idx]- else:- desc2 = desc+ 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:+ 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))- justFileName = os.path.split(desc2)[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))+ 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++ 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))def normSlashes(path):return path.replace(os.sep, '/')@@ -292,10 +306,11 @@ def checkSolrWAR(warFileName, svnRevision, version, tmpDir, baseURL):for file in getBinaryDistFiles('lucene', tmpDir, version, baseURL):distFilenames[os.path.basename(file)] = file- with zipfile.ZipFile(warFileName, 'r') as z:- for name in z.namelist():+ for (dirpath, subdirs, files) in os.walk(warFileName):+ for name in files:if name.endswith('.jar'):- jarInsideWarContents = z.read(name)+ 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:@@ -755,7 +770,7 @@ def verifyUnpacked(java, project, artifact, unpackPath, svnRevision, version, techeckJavadocpath('%s/docs' % unpackPath)else:- checkSolrWAR('%s/server/webapps/solr.war' % unpackPath, svnRevision, version, tmpDir, baseURL)+ checkSolrWAR('%s/server/solr-webapp/webapp' % unpackPath, svnRevision, version, tmpDir, baseURL)print(' copying unpacked distribution for Java 8 ...')java8UnpackPath = '%s-java8' % unpackPathdiff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 07c952d876a..d405af42b19 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -361,6 +361,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)+================== 5.2.1 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this releasediff --git a/solr/README.txt b/solr/README.txtindex 448f79bbb58..af2bb0cfb12 100644--- a/solr/README.txt+++ b/solr/README.txt@@ -151,7 +151,7 @@ Instructions for Building Apache Solr from SourceNOTE:To see Solr in action, you may want to use the "ant server" command to build- and package Solr into the server/webapps directory. See also server/README.txt.+ and package Solr into the server directory. See also server/README.txt.Export controldiff --git a/solr/bin/solr b/solr/bin/solrindex 17459265bb2..f46251f7079 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -412,13 +412,6 @@ function jetty_port() {# run a Solr command-line tool using the SolrCLI class;# useful for doing cross-platform work from the command-line using Javafunction run_tool() {-- # Extract the solr.war if it hasn't been done already (so we can access the SolrCLI class)- if [[ -e "$DEFAULT_SERVER_DIR/webapps/solr.war" && ! -d "$DEFAULT_SERVER_DIR/solr-webapp/webapp" ]]; then- (mkdir -p "$DEFAULT_SERVER_DIR/solr-webapp/webapp" && \- cd "$DEFAULT_SERVER_DIR/solr-webapp/webapp" && \- "${UNPACK_WAR_CMD[@]}" "$DEFAULT_SERVER_DIR/webapps/solr.war")- fi"$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS -Dsolr.install.dir="$SOLR_TIP" \-Dlog4j.configuration="file:$DEFAULT_SERVER_DIR/scripts/cloud-scripts/log4j.properties" \diff --git a/solr/build.xml b/solr/build.xmlindex 54fdb648913..7c1e790012f 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -51,9 +51,6 @@<attribute name="Main-Class" value="org.apache.solr.util.SimplePostTool"/></manifest></jar>- <delete includeemptydirs="true">- <fileset dir="${server.dir}/solr-webapp" includes="**/*"/>- </delete><echo>See ${common-solr.dir}/README.txt for how to run the Solr server.</echo></target>@@ -372,7 +369,7 @@<include name="solr/zoo_data/" /><include name="start.jar" /><include name="logs/*" />- <include name="webapps/**/*" />+ <include name="webapps" /><include name="solr-webapp/**/*" /><exclude name="**/.gitignore" /></fileset>@@ -517,7 +514,6 @@</antcall><mkdir dir="${dest}/${fullnamever}"/><delete includeemptydirs="true">- <fileset dir="${server.dir}/solr-webapp" includes="**/*"/><fileset dir="${dest}/${fullnamever}" includes="**/*"/></delete>diff --git a/solr/cloud-dev/solrcloud-start.sh b/solr/cloud-dev/solrcloud-start.shindex 30ac0b8d787..bf256184f11 100755--- a/solr/cloud-dev/solrcloud-start.sh+++ b/solr/cloud-dev/solrcloud-start.sh@@ -43,9 +43,6 @@ rm -f server/server.logant -f ../build.xml cleanant server dist-rm -r server/solr-webapp/*-unzip server/webapps/solr.war -d server/solr-webapp/webapp-for (( i=1; i <= $numServers; i++ ))doecho "create server$i"diff --git a/solr/server/README.txt b/solr/server/README.txtindex e6fba3d9649..744f47975aa 100644--- a/solr/server/README.txt+++ b/solr/server/README.txt@@ -75,11 +75,7 @@ server/solr/configsetsserver/solr-webapp- Jetty will extract the solr.war into this directory at runtime.--server/webapps-- Contains the solr.war file.+ Contains files used by the Solr server; do not edit files in this directory (Solr is not a Java Web application).Notes About Solr Examplesdiff --git a/solr/server/contexts/solr-jetty-context.xml b/solr/server/contexts/solr-jetty-context.xmlindex 2383639164c..5bf2d9a1400 100644--- a/solr/server/contexts/solr-jetty-context.xml+++ b/solr/server/contexts/solr-jetty-context.xml@@ -2,8 +2,6 @@<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"><Configure class="org.eclipse.jetty.webapp.WebAppContext"><Set name="contextPath"><Property name="hostContext" default="/solr"/></Set>- <Set name="war"><Property name="jetty.base"/>/webapps/solr.war</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="tempDirectory"><Property name="jetty.base" default="."/>/solr-webapp</Set>- <Set name="persistTempDirectory">true</Set></Configure>diff --git a/solr/server/scripts/cloud-scripts/zkcli.bat b/solr/server/scripts/cloud-scripts/zkcli.batindex c894c96e9d1..933e8a3a44a 100644--- a/solr/server/scripts/cloud-scripts/zkcli.bat+++ b/solr/server/scripts/cloud-scripts/zkcli.bat@@ -9,13 +9,4 @@ REM Find location of this scriptset SDIR=%~dp0if "%SDIR:~-1%"=="\" set SDIR=%SDIR:~0,-1%-IF exist %SDIR%\..\..\solr-webapp\webapp\nul (- echo %SDIR%\..\..\solr-webapp\webapp exists-) ELSE (- echo -------------------- echo Unzip server\webapps\solr.war to server\solr-webapp\. to use this script.- echo Starting Solr via "bin\solr.cmd start" will also do this extraction.- echo --------------------)-"%JVM%" -Dlog4j.configuration="file:%SDIR%\log4j.properties" -classpath "%SDIR%\..\..\solr-webapp\webapp\WEB-INF\lib\*;%SDIR%\..\..\lib\ext\*" org.apache.solr.cloud.ZkCLI %*diff --git a/solr/server/scripts/cloud-scripts/zkcli.sh b/solr/server/scripts/cloud-scripts/zkcli.shindex 3110898ea9e..15b5392d2e5 100755--- a/solr/server/scripts/cloud-scripts/zkcli.sh+++ b/solr/server/scripts/cloud-scripts/zkcli.sh@@ -9,9 +9,5 @@ JVM="java"sdir="`dirname \"$0\"`"-if [ ! -d "$sdir/../../solr-webapp/webapp" ]; then- unzip $sdir/../../webapps/solr.war -d $sdir/../../solr-webapp/webapp-fi-PATH=$JAVA_HOME/bin:$PATH $JVM -Dlog4j.configuration=file:$sdir/log4j.properties -classpath "$sdir/../../solr-webapp/webapp/WEB-INF/lib/*:$sdir/../../lib/ext/*" org.apache.solr.cloud.ZkCLI ${1+"$@"}diff --git a/solr/server/scripts/map-reduce/set-map-reduce-classpath.sh b/solr/server/scripts/map-reduce/set-map-reduce-classpath.shindex 14d822c0463..0d22f63f801 100755--- a/solr/server/scripts/map-reduce/set-map-reduce-classpath.sh+++ b/solr/server/scripts/map-reduce/set-map-reduce-classpath.sh@@ -22,12 +22,6 @@ solr_distrib="$sdir/../../.."echo `absPath $solr_distrib`-# extract war if necessary--if [ ! -d "$solr_distrib/server/solr-webapp/webapp" ]; then- unzip -o $solr_distrib/server/webapps/solr.war -d $solr_distrib/server/solr-webapp/webapp-fi-# Setup env variables for MapReduceIndexerTool# Setup HADOOP_CLASSPATHdiff --git a/solr/webapp/build.xml b/solr/webapp/build.xmlindex ec8138e78e9..cca513b66ae 100644--- a/solr/webapp/build.xml+++ b/solr/webapp/build.xml@@ -46,6 +46,7 @@<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}">@@ -60,6 +61,14 @@<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"/>+</target><!-- nothing to do -->