diff --git a/build.xml b/build.xml index e1d9a5b759d..96265d725df 100644 --- a/build.xml +++ b/build.xml @@ -296,7 +296,7 @@ + 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/**" /> diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 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: - 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)) - - 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)) + s = None + notice = None + license = None - 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?)' % \ + # 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): + 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: + 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)) + + + 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)) + idx = desc.find('inside WAR file') + if idx != -1: + desc2 = desc[:idx] + else: + desc2 = desc - 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: - 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(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, te checkJavadocpath('%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' % unpackPath diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 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 loaded from $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 release diff --git a/solr/README.txt b/solr/README.txt index 448f79bbb58..af2bb0cfb12 100644 --- a/solr/README.txt +++ b/solr/README.txt @@ -151,7 +151,7 @@ Instructions for Building Apache Solr from Source NOTE: 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 control diff --git a/solr/bin/solr b/solr/bin/solr index 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 Java function 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.xml index 54fdb648913..7c1e790012f 100644 --- a/solr/build.xml +++ b/solr/build.xml @@ -51,9 +51,6 @@ - - - See ${common-solr.dir}/README.txt for how to run the Solr server. @@ -372,7 +369,7 @@ - + @@ -517,7 +514,6 @@ - diff --git a/solr/cloud-dev/solrcloud-start.sh b/solr/cloud-dev/solrcloud-start.sh index 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.log ant -f ../build.xml clean ant server dist -rm -r server/solr-webapp/* -unzip server/webapps/solr.war -d server/solr-webapp/webapp - for (( i=1; i <= $numServers; i++ )) do echo "create server$i" diff --git a/solr/server/README.txt b/solr/server/README.txt index e6fba3d9649..744f47975aa 100644 --- a/solr/server/README.txt +++ b/solr/server/README.txt @@ -75,11 +75,7 @@ server/solr/configsets server/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 Examples diff --git a/solr/server/contexts/solr-jetty-context.xml b/solr/server/contexts/solr-jetty-context.xml index 2383639164c..5bf2d9a1400 100644 --- a/solr/server/contexts/solr-jetty-context.xml +++ b/solr/server/contexts/solr-jetty-context.xml @@ -2,8 +2,6 @@ - /webapps/solr.war + /solr-webapp/webapp /etc/webdefault.xml - /solr-webapp - true diff --git a/solr/server/scripts/cloud-scripts/zkcli.bat b/solr/server/scripts/cloud-scripts/zkcli.bat index 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 script set SDIR=%~dp0 if "%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.sh index 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.sh index 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_CLASSPATH diff --git a/solr/webapp/build.xml b/solr/webapp/build.xml index ec8138e78e9..cca513b66ae 100644 --- a/solr/webapp/build.xml +++ b/solr/webapp/build.xml @@ -46,6 +46,7 @@ + @@ -60,6 +61,14 @@ + + + + + + + +