SOLR-7227: Solr distribution archive should have the WAR file extracted already

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1692925 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2015-07-27 18:12:45 +00:00
parent 360305b386
commit 2eb704ef50
13 changed files with 100 additions and 112 deletions

View File

@ -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"/>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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" \

View File

@ -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>

View File

@ -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"

View File

@ -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

View File

@ -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>

View File

@ -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 %*

View File

@ -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+"$@"}

View File

@ -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

View File

@ -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 -->