Permalink
Browse files

ISPN-1959 Reduce size of distribution bundle

* add all runtime dependencies to a global lib dir inside the bundle so we avoid jar duplication and reduce the total size
* for each infinispan module a runtime-classpath.txt file is generated and placed beside the jar
* all bat and sh script in bin folder were updated to reflect these runtime classpath changes
* exclude some unwanted folders from src bundle: ObjectStore, out, .idea ...
* rename top folder inside zip bundle to be the same as zip name (used to be project name for all bundles without the src/bin/all suffix)
* fix POM so tests are not executed while 'distribution' profile is active
* 'all' and 'bin' bundles contained two unwanted 'main' and 'test' folders (were CDI sources)
* no longer produce most "*-classes.jar" artifacts attached to WARs, except for rest server WAR (JDG seems to use *-classes.jar rather than the war)
  • Loading branch information...
1 parent d36ef05 commit 23edf4f687986d3cdba33b506600457142b19e2e @anistor anistor committed with galderz Jul 9, 2012
Showing with 284 additions and 199 deletions.
  1. +7 −8 cli/cli-client/src/main/resources/ispn-cli.bat
  2. +2 −1 cli/cli-client/src/main/resources/ispn-cli.sh
  3. +4 −3 core/src/main/release/README-Modules.txt
  4. +2 −0 core/src/main/resources/functions.sh
  5. +7 −6 core/src/main/resources/importConfig.bat
  6. +4 −3 core/src/main/resources/importConfig.sh
  7. +2 −3 demos/distexec/src/main/resources/runPiApproximationDemo.sh
  8. +2 −3 demos/distexec/src/main/resources/runWordCountDemo.sh
  9. +3 −5 demos/ec2/src/main/resources/runEC2Demo-all.sh
  10. +3 −5 demos/ec2/src/main/resources/runEC2Demo-influenza.sh
  11. +3 −5 demos/ec2/src/main/resources/runEC2Demo-nucleotide.sh
  12. +3 −5 demos/ec2/src/main/resources/runEC2Demo-protein.sh
  13. +3 −5 demos/ec2/src/main/resources/runEC2Demo-query.sh
  14. +3 −5 demos/ec2/src/main/resources/runEC2Demo-reader.sh
  15. +9 −20 demos/gui/src/main/resources/runGuiDemo.bat
  16. +2 −3 demos/gui/src/main/resources/runGuiDemo.sh
  17. +9 −18 demos/lucene-directory-demo/src/main/resources/runLuceneDemo.bat
  18. +2 −3 demos/lucene-directory-demo/src/main/resources/runLuceneDemo.sh
  19. +0 −1 demos/nearcache-client/pom.xml
  20. +43 −10 parent/pom.xml
  21. +1 −7 pom.xml
  22. +15 −15 server/core/src/main/resources/startServer.bat
  23. +8 −6 server/core/src/main/resources/startServer.sh
  24. +3 −1 server/rest/pom.xml
  25. +68 −38 src/main/resources/assemblies/all.xml
  26. +61 −17 src/main/resources/assemblies/bin.xml
  27. +7 −1 src/main/resources/assemblies/rest-server.xml
  28. +8 −2 src/main/resources/assemblies/src.xml
@@ -1,14 +1,13 @@
@echo off
setlocal enabledelayedexpansion
+set ISPN_HOME=%~dp0
+set ISPN_HOME="%ISPN_HOME%.."
-set LIB=
-for %%f in (..\modules\cli-client\lib\*.jar) do set LIB=!LIB!;%%f
-rem echo libs: %LIB%
-
-set CP=%LIB%
-set CP=..\modules\cli-client\infinispan-cli-client.jar;%CP%
+set /p CP=<%ISPN_HOME%\modules\cli-client\runtime-classpath.txt
+set CP=%CP::=;%
+set CP=%CP:$ISPN_HOME=!ISPN_HOME!%
+set CP=%ISPN_HOME%\modules\cli-client\infinispan-cli-client.jar;%CP%
+rem echo libs: %CP%
java -classpath "%CP%" org.infinispan.cli.Main %*
-
-:fileEnd
@@ -2,7 +2,8 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}/modules/cli-client"
+add_classpath ${ISPN_HOME}/modules/cli-client/*.jar
+add_classpath ${ISPN_HOME}/modules/cli-client/runtime-classpath.txt
add_jvm_args $JVM_PARAMS
@@ -1,6 +1,7 @@
-Infinispan requires 'infinispan-core.jar' as well as all libraries in the 'lib' directory to be on your classpath, or
+Infinispan requires 'infinispan-core.jar' as well as all libraries listed in the runtime-classpath.txt file.
+The required libraries are located in the 'lib' directory and must be added to your classpath, or
packaged with your deployment.
This distribution also ships with a number of optional modules, in the 'modules' directory. If you wish to use one or
-more of these modules, you will also need the module's jar file and all of its dependencies ('modules/MODULE_NAME/lib')
-to be on your classpath, in addition to the jars mentioned earlier.
+more of these modules, you will also need the module's jar file and all of its dependencies (listed in the corresponding
+runtime-classpath.txt file) to be on your classpath.
@@ -52,6 +52,8 @@ function add_classpath() {
fi
elif [[ -f "$E" && "$E" =~ \.([Jj][Aa][Rr]|[Zz][Ii][Pp])$ ]]; then
CLASSPATH="$CLASSPATH:$E"
+ elif [[ -f "$E" && "$E" =~ /runtime-classpath\.txt$ ]]; then
+ CLASSPATH=$CLASSPATH:`eval echo $(<$E)`
fi
if [[ "$CLASSPATH" =~ ^: ]]; then
@@ -1,12 +1,13 @@
@echo off
setlocal enabledelayedexpansion
+set ISPN_HOME=%~dp0
+set ISPN_HOME="%ISPN_HOME%.."
-set LIB=
-for %%f in (..\lib\*.jar) do set LIB=!LIB!;%%f
-rem echo libs: %LIB%
-
-set CP=%LIB%;..\infinispan-core.jar;%CP%
+set /p CP=<%ISPN_HOME%\runtime-classpath.txt
+set CP=%CP::=;%
+set CP=%CP:$ISPN_HOME=!ISPN_HOME!%
+set CP=%ISPN_HOME%\infinispan-core.jar;%CP%
+rem echo libs: %CP%
java -classpath "%CP%" org.infinispan.config.parsing.ConfigFilesConvertor %1 %2 %3 %4 %5 %6
-:fileEnd
@@ -2,8 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/lib"
+add_classpath ${ISPN_HOME}/*.jar
+add_classpath ${ISPN_HOME}/runtime-classpath.txt
-start org.infinispan.config.parsing.ConfigFilesConvertor "$@"
+add_program_args "$@"
+start org.infinispan.config.parsing.ConfigFilesConvertor
@@ -2,9 +2,8 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules/demos/distexec"
+add_classpath ${ISPN_HOME}/modules/demos/distexec/*.jar
+add_classpath ${ISPN_HOME}/modules/demos/distexec/runtime-classpath.txt
add_jvm_args $JVM_PARAMS
add_jvm_args '-Djava.net.preferIPv4Stack=true'
@@ -2,9 +2,8 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules/demos/distexec"
+add_classpath ${ISPN_HOME}/modules/demos/distexec/*.jar
+add_classpath ${ISPN_HOME}/modules/demos/distexec/runtime-classpath.txt
add_jvm_args $JVM_PARAMS
add_jvm_args '-Djava.net.preferIPv4Stack=true'
@@ -2,11 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/etc"
-add_classpath "${ISPN_HOME}/etc/config-sameples/ec2-demo"
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules/demos/ec2"
+add_classpath ${ISPN_HOME}/etc
+add_classpath ${ISPN_HOME}/etc/config-samples/ec2-demo
+add_classpath ${ISPN_HOME}/modules/demos/ec2/runtime-classpath.txt
add_jvm_args '-Xmx512m'
add_jvm_args $JVM_PARAMS
@@ -2,11 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/etc"
-add_classpath "${ISPN_HOME}/etc/config-samples/ec2-demo"
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules"
+add_classpath ${ISPN_HOME}/etc
+add_classpath ${ISPN_HOME}/etc/config-samples/ec2-demo
+add_classpath ${ISPN_HOME}/modules/demos/ec2/runtime-classpath.txt
if [[ ! -e ${ISPN_HOME}/etc/Amazon-TestData/influenza.dat ]]; then
gunzip ${ISPN_HOME}/etc/Amazon-TestData/influenza.dat.gz > /dev/null
@@ -2,11 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/etc"
-add_classpath "${ISPN_HOME}/etc/config-samples/ec2-demo"
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules"
+add_classpath ${ISPN_HOME}/etc
+add_classpath ${ISPN_HOME}/etc/config-samples/ec2-demo
+add_classpath ${ISPN_HOME}/modules/demos/ec2/runtime-classpath.txt
if [[ ! -e ${ISPN_HOME}/etc/Amazon-TestData/influenza_na.dat ]]; then
gunzip ${ISPN_HOME}/etc/Amazon-TestData/influenza_na.dat.gz > /dev/null
@@ -2,11 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/etc"
-add_classpath "${ISPN_HOME}/etc/config-samples/ec2-demo"
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules"
+add_classpath ${ISPN_HOME}/etc
+add_classpath ${ISPN_HOME}/etc/config-samples/ec2-demo
+add_classpath ${ISPN_HOME}/modules/demos/ec2/runtime-classpath.txt
if [[ ! -e ${ISPN_HOME}/etc/Amazon-TestData/influenza_aa.dat ]]; then
gunzip ${ISPN_HOME}/etc/Amazon-TestData/influenza_aa.dat.gz > /dev/null
@@ -2,11 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/etc"
-add_classpath "${ISPN_HOME}/etc/config-samples/ec2-demo"
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules"
+add_classpath ${ISPN_HOME}/etc
+add_classpath ${ISPN_HOME}/etc/config-samples/ec2-demo
+add_classpath ${ISPN_HOME}/modules/demos/ec2/runtime-classpath.txt
add_jvm_args '-Xmx512m'
add_jvm_args $JVM_PARAMS
@@ -2,11 +2,9 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/etc"
-add_classpath "${ISPN_HOME}/etc/config-samples/ec2-demo"
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules"
+add_classpath ${ISPN_HOME}/etc
+add_classpath ${ISPN_HOME}/etc/config-samples/ec2-demo
+add_classpath ${ISPN_HOME}/modules/demos/ec2/runtime-classpath.txt
add_jvm_args '-Xmx512m'
add_jvm_args $JVM_PARAMS
@@ -1,29 +1,18 @@
@echo off
-:noenvreset
-set my_classpath=
-for /f "tokens=* delims=" %%f in ('dir /s /b /a-d "..\lib\*.jar"') do (
- call set my_classpath=%%my_classpath%%;%%~f)
- )
-set my_classpath=%my_classpath:~1%
+setlocal enabledelayedexpansion
+set ISPN_HOME=%~dp0
+set ISPN_HOME="%ISPN_HOME%.."
-set my_classpath=%my_classpath%;..\infinispan-core.jar
-
-for /f "tokens=* delims=" %%f in ('dir /s /b /a-d "..\modules\demos\gui\*.jar"') do (
- call set my_classpath=%%my_classpath%%;%%~f)
- )
-set my_classpath=%my_classpath:~1%
-
-for /f "tokens=* delims=" %%f in ('dir /s /b /a-d "..\modules\demos\gui\lib\*.jar"') do (
- call set my_classpath=%%my_classpath%%;%%~f)
- )
-set my_classpath=%my_classpath:~1%
+set /p CP=<%ISPN_HOME%\modules\demos\gui\runtime-classpath.txt
+set CP=%CP::=;%
+set CP=%CP:$ISPN_HOME=!ISPN_HOME!%
+set CP=%ISPN_HOME%\modules\demos\gui\infinispan-gui-demo.jar;%CP%
+rem echo libs: %CP%
:test
set /a "TESTPORT=%RANDOM%+2000"
netstat -an | findstr ":%TESTPORT% "
if %ERRORLEVEL%==0 goto test
-java -cp "%my_classpath%" -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=%TESTPORT% -Djgroups.bind_addr=127.0.0.1 -Djava.net.preferIPv4Stack=true -Dlog4j.configuration=..\etc\log4j.xml -Dsun.nio.ch.bugLevel="" org.infinispan.demo.InfinispanDemo
-
-
+java -cp "%CP%" -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=%TESTPORT% -Djgroups.bind_addr=127.0.0.1 -Djava.net.preferIPv4Stack=true -Dlog4j.configuration=%ISPN_HOME%\etc\log4j.xml -Dsun.nio.ch.bugLevel="" org.infinispan.demo.InfinispanDemo
@@ -2,9 +2,8 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules/demos/gui"
+add_classpath ${ISPN_HOME}/modules/demos/gui/*.jar
+add_classpath ${ISPN_HOME}/modules/demos/gui/runtime-classpath.txt
add_jvm_args $JVM_PARAMS
add_jvm_args '-Djgroups.bind_addr=127.0.0.1'
@@ -1,27 +1,18 @@
@echo off
-:noenvreset
-set my_classpath=
-for /f "tokens=* delims=" %%f in ('dir /s /b /a-d "..\lib\*.jar"') do (
- call set my_classpath=%%my_classpath%%;%%~f)
- )
-set my_classpath=%my_classpath:~1%
+setlocal enabledelayedexpansion
+set ISPN_HOME=%~dp0
+set ISPN_HOME="%ISPN_HOME%.."
-set my_classpath=%my_classpath%;..\infinispan-core.jar
-
-for /f "tokens=* delims=" %%f in ('dir /s /b /a-d "..\modules\demos\lucene-directory-demo\*.jar"') do (
- call set my_classpath=%%my_classpath%%;%%~f)
- )
-set my_classpath=%my_classpath:~1%
-
-for /f "tokens=* delims=" %%f in ('dir /s /b /a-d "..\modules\demos\lucene-directory-demo\lib\*.jar"') do (
- call set my_classpath=%%my_classpath%%;%%~f)
- )
-set my_classpath=%my_classpath:~1%
+set /p CP=<%ISPN_HOME%\modules\demos\lucene-directory-demo\runtime-classpath.txt
+set CP=%CP::=;%
+set CP=%CP:$ISPN_HOME=!ISPN_HOME!%
+set CP=%ISPN_HOME%\modules\demos\lucene-directory-demo\infinispan-lucene-demo.jar;%CP%
+rem echo libs: %CP%
:test
set /a "TESTPORT=%RANDOM%+2000"
netstat -an | findstr ":%TESTPORT% "
if %ERRORLEVEL%==0 goto test
-java -cp "%my_classpath%" -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=%TESTPORT% -Djgroups.bind_addr=127.0.0.1 -Djava.net.preferIPv4Stack=true -Dlog4j.configuration=..\etc\log4j.xml -Dsun.nio.ch.bugLevel="" org.infinispan.lucenedemo.DemoDriver
+java -cp "%CP%" -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=%TESTPORT% -Djgroups.bind_addr=127.0.0.1 -Djava.net.preferIPv4Stack=true -Dlog4j.configuration=%ISPN_HOME%\etc\log4j.xml -Dsun.nio.ch.bugLevel="" org.infinispan.lucenedemo.DemoDriver
@@ -2,9 +2,8 @@
source "`dirname "$0"`/functions.sh"
-add_classpath "${ISPN_HOME}"/*.jar
-add_classpath "${ISPN_HOME}/lib"
-add_classpath "${ISPN_HOME}/modules/demos/lucene-directory-demo"
+add_classpath ${ISPN_HOME}/modules/demos/lucene-directory-demo/*.jar
+add_classpath ${ISPN_HOME}/modules/demos/lucene-directory-demo/runtime-classpath.txt
add_jvm_args $JVM_PARAMS
add_jvm_args '-Djgroups.bind_addr=127.0.0.1'
@@ -139,7 +139,6 @@
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
<configuration>
<!-- No web.xml needed in Java EE 6 -->
<failOnMissingWebXml>false</failOnMissingWebXml>
View
@@ -49,11 +49,11 @@
</developers>
<mailingLists>
<mailingList>
- <name>Infinispan Commit Notificatons</name>
- <subscribe>https://lists.jboss.org/mailman/listinfo/infinispan-commits</subscribe>
- <unsubscribe>https://lists.jboss.org/mailman/listinfo/infinispan-commits</unsubscribe>
- <post>infinispan-commits@lists.jboss.org</post>
- <archive>http://lists.jboss.org/pipermail/infinispan-commits/</archive>
+ <name>Infinispan Issues</name>
+ <subscribe>https://lists.jboss.org/mailman/listinfo/infinispan-issues</subscribe>
+ <unsubscribe>https://lists.jboss.org/mailman/listinfo/infinispan-issues</unsubscribe>
+ <post>infinispan-issues@lists.jboss.org</post>
+ <archive>http://lists.jboss.org/pipermail/infinispan-issues/</archive>
</mailingList>
<mailingList>
<name>Infinispan Developers</name>
@@ -917,14 +917,14 @@
<version>${version.maven.bundle}</version>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-3</version>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
- <version>2.0</version>
+ <version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -952,7 +952,7 @@
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
- <attachClasses>true</attachClasses>
+ <attachClasses>false</attachClasses>
</configuration>
</plugin>
<plugin>
@@ -1329,6 +1329,39 @@
</reporting>
<profiles>
<profile>
+ <id>distribution</id>
+ <properties>
+ <skipTests>true</skipTests>
+ </properties>
+
+ <build>
+ <plugins>
+ <!-- generate target/runtime-classpath.txt, to be included in bundle -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-classpath</id>
+ <phase>package</phase>
+ <goals>
+ <goal>build-classpath</goal>
+ </goals>
+ <configuration>
+ <includeScope>runtime</includeScope>
+ <excludeScope>test</excludeScope>
+ <!-- all jar paths are relative to bin dir inside the distribution bundle -->
+ <prefix>$ISPN_HOME/lib</prefix>
+ <outputFile>${project.build.directory}/runtime-classpath.txt</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
<id>extras</id>
<activation>
<activeByDefault>true</activeByDefault>
Oops, something went wrong.

0 comments on commit 23edf4f

Please sign in to comment.