You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by dr...@apache.org on 2022/08/16 13:18:41 UTC
[ratis] 12/12: RATIS-1669. Combine shell lib folder and root jars folder (#711)
This is an automated email from the ASF dual-hosted git repository.
dragonyliu pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/ratis.git
commit 3bfaa496e97167cc9554e32284be159383b808ea
Author: leo65535 <le...@163.com>
AuthorDate: Fri Aug 12 16:45:51 2022 +0800
RATIS-1669. Combine shell lib folder and root jars folder (#711)
(cherry picked from commit 8b69f748e1d5495c7f860c790323f65cd9594ce0)
---
.gitignore | 1 +
pom.xml | 5 +++
ratis-assembly/src/main/assembly/bin.xml | 31 ----------------
ratis-assembly/src/main/assembly/examples-bin.xml | 14 +++-----
ratis-assembly/src/main/assembly/shell-bin.xml | 13 ++++---
ratis-examples/pom.xml | 5 ++-
ratis-shell/pom.xml | 41 +++++++---------------
ratis-shell/src/main/libexec/ratis-shell-config.sh | 11 ++++++
8 files changed, 43 insertions(+), 78 deletions(-)
diff --git a/.gitignore b/.gitignore
index 11a695c7e..f56494487 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@
target
build
patchprocess
+dependency-reduced-pom.xml
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7743fa9dd..f6f0acd66 100644
--- a/pom.xml
+++ b/pom.xml
@@ -392,6 +392,11 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.29</version>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.7.29</version>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
diff --git a/ratis-assembly/src/main/assembly/bin.xml b/ratis-assembly/src/main/assembly/bin.xml
index 2d0858eb9..59462c322 100644
--- a/ratis-assembly/src/main/assembly/bin.xml
+++ b/ratis-assembly/src/main/assembly/bin.xml
@@ -76,36 +76,5 @@
<fileMode>0644</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
- <!-- Include dev support tools -->
-<!-- <fileSet>-->
-<!-- <directory>${project.basedir}/../dev-support</directory>-->
-<!-- <outputDirectory>dev-support</outputDirectory>-->
-<!-- <fileMode>0644</fileMode>-->
-<!-- <directoryMode>0755</directoryMode>-->
-<!-- </fileSet>-->
-<!-- <fileSet>-->
-<!-- <directory>${project.basedir}/../ratis-shell/target/</directory>-->
-<!-- <outputDirectory>ratis-shell/lib/shell</outputDirectory>-->
-<!-- <fileMode>755</fileMode>-->
-<!-- <includes>-->
-<!-- <include>ratis-shell-*-jar-with-dependencies.jar</include>-->
-<!-- </includes>-->
-<!-- </fileSet>-->
-<!-- <fileSet>-->
-<!-- <directory>${project.basedir}/../ratis-shell/src/main/bin</directory>-->
-<!-- <outputDirectory>ratis-shell/bin</outputDirectory>-->
-<!-- <fileMode>755</fileMode>-->
-<!-- </fileSet>-->
-<!-- <fileSet>-->
-<!-- <directory>${project.basedir}/../ratis-shell/src/main/libexec</directory>-->
-<!-- <outputDirectory>ratis-shell/libexec</outputDirectory>-->
-<!-- <fileMode>0644</fileMode>-->
-<!-- <directoryMode>0755</directoryMode>-->
-<!-- </fileSet>-->
-<!-- <fileSet>-->
-<!-- <directory>${project.basedir}/../ratis-shell/src/main/conf</directory>-->
-<!-- <outputDirectory>ratis-shell/conf</outputDirectory>-->
-<!-- <fileMode>644</fileMode>-->
-<!-- </fileSet>-->
</fileSets>
</assembly>
diff --git a/ratis-assembly/src/main/assembly/examples-bin.xml b/ratis-assembly/src/main/assembly/examples-bin.xml
index c88f75930..340fd5b2c 100644
--- a/ratis-assembly/src/main/assembly/examples-bin.xml
+++ b/ratis-assembly/src/main/assembly/examples-bin.xml
@@ -52,8 +52,8 @@
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
- <directory>${project.basedir}/src/main/resources</directory>
- <outputDirectory>.</outputDirectory>
+ <directory>${project.basedir}/../ratis-examples</directory>
+ <outputDirectory>examples</outputDirectory>
<includes>
<include>README.md</include>
</includes>
@@ -65,19 +65,13 @@
<includes>
<include>*.*</include>
</includes>
- <fileMode>755</fileMode>
+ <fileMode>0755</fileMode>
</fileSet>
- <!-- Include dev support tools -->
-<!-- <fileSet>-->
-<!-- <directory>${project.basedir}/../dev-support</directory>-->
-<!-- <outputDirectory>dev-support</outputDirectory>-->
-<!-- <fileMode>0644</fileMode>-->
-<!-- <directoryMode>0755</directoryMode>-->
-<!-- </fileSet>-->
<fileSet>
<directory>${project.basedir}/../ratis-examples/src/main/resources</directory>
<outputDirectory>examples/conf</outputDirectory>
<includes>
+ <include>conf.properties</include>
<include>log4j.properties</include>
</includes>
<fileMode>644</fileMode>
diff --git a/ratis-assembly/src/main/assembly/shell-bin.xml b/ratis-assembly/src/main/assembly/shell-bin.xml
index 5ecbb5ca6..86424d854 100644
--- a/ratis-assembly/src/main/assembly/shell-bin.xml
+++ b/ratis-assembly/src/main/assembly/shell-bin.xml
@@ -22,12 +22,15 @@
<fileSets>
<fileSet>
<directory>${project.basedir}/../ratis-shell/target/</directory>
- <outputDirectory>lib/shell</outputDirectory>
- <fileMode>755</fileMode>
+ <outputDirectory>jars</outputDirectory>
<includes>
- <include>ratis-shell-*-jar-with-dependencies.jar</include>
+ <include>ratis-shell-${project.version}.jar</include>
</includes>
</fileSet>
+ <fileSet>
+ <directory>${project.basedir}/../ratis-shell/target/lib/</directory>
+ <outputDirectory>jars</outputDirectory>
+ </fileSet>
<fileSet>
<directory>${project.basedir}/..</directory>
<outputDirectory>.</outputDirectory>
@@ -48,12 +51,12 @@
<fileSet>
<directory>${project.basedir}/../ratis-shell/src/main/bin</directory>
<outputDirectory>bin</outputDirectory>
- <fileMode>755</fileMode>
+ <fileMode>0755</fileMode>
</fileSet>
<fileSet>
<directory>${project.basedir}/../ratis-shell/src/main/libexec</directory>
<outputDirectory>libexec</outputDirectory>
- <fileMode>0644</fileMode>
+ <fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
<fileSet>
diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml
index a3213c212..1f8b86041 100644
--- a/ratis-examples/pom.xml
+++ b/ratis-examples/pom.xml
@@ -147,9 +147,8 @@
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>**/org/apache/log4j/chainsaw/**</exclude>
- <exclude>**/org/apache/log4j/jdbc/JDBCAppender.class</exclude>
- <exclude>**/org/apache/log4j/net/JMSAppender.class</exclude>
- <exclude>**/org/apache/log4j/net/JMSSink.class</exclude>
+ <exclude>**/org/apache/log4j/jdbc/**</exclude>
+ <exclude>**/org/apache/log4j/net/**</exclude>
</excludes>
</filter>
</filters>
diff --git a/ratis-shell/pom.xml b/ratis-shell/pom.xml
index 12345d772..c3b8d5e76 100644
--- a/ratis-shell/pom.xml
+++ b/ratis-shell/pom.xml
@@ -27,10 +27,12 @@
<dependency>
<artifactId>ratis-client</artifactId>
<groupId>org.apache.ratis</groupId>
+ <scope>provided</scope>
</dependency>
<dependency>
<artifactId>ratis-common</artifactId>
<groupId>org.apache.ratis</groupId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -42,6 +44,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ </dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
@@ -52,41 +58,18 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-shade-plugin</artifactId>
+ <artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
+ <id>copy</id>
<phase>package</phase>
<goals>
- <goal>shade</goal>
+ <goal>copy-dependencies</goal>
</goals>
<configuration>
- <finalName>${project.artifactId}-${project.version}-jar-with-dependencies</finalName>
-
- <filters>
- <filter>
- <artifact>*:*</artifact>
- <excludes>
- <exclude>LICENSE</exclude>
- <exclude>META-INF/*.SF</exclude>
- <exclude>META-INF/*.DSA</exclude>
- <exclude>META-INF/*.RSA</exclude>
- <exclude>**/org/apache/log4j/chainsaw/**</exclude>
- <exclude>**/org/apache/log4j/jdbc/JDBCAppender.class</exclude>
- <exclude>**/org/apache/log4j/net/JMSAppender.class</exclude>
- <exclude>**/org/apache/log4j/net/JMSSink.class</exclude>
- </excludes>
- </filter>
- </filters>
-
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
-
- <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
- <manifestEntries>
- <Main-Class>org.apache.ratis.shell.cli.sh.RatisShell</Main-Class>
- </manifestEntries>
- </transformer>
- </transformers>
+ <outputDirectory>
+ ${project.build.directory}/lib
+ </outputDirectory>
</configuration>
</execution>
</executions>
diff --git a/ratis-shell/src/main/libexec/ratis-shell-config.sh b/ratis-shell/src/main/libexec/ratis-shell-config.sh
index 0fed399a4..f2b4f3c38 100644
--- a/ratis-shell/src/main/libexec/ratis-shell-config.sh
+++ b/ratis-shell/src/main/libexec/ratis-shell-config.sh
@@ -32,6 +32,7 @@ RATIS_SHELL_HOME=$(dirname $(dirname "${this}"))
RATIS_SHELL_ASSEMBLY_CLIENT_JAR="${RATIS_SHELL_HOME}/lib/shell/*"
RATIS_SHELL_CONF_DIR="${RATIS_SHELL_CONF_DIR:-${RATIS_SHELL_HOME}/conf}"
RATIS_SHELL_LOGS_DIR="${RATIS_SHELL_LOGS_DIR:-${RATIS_SHELL_HOME}/logs}"
+RATIS_SHELL_LIB_DIR="${RATIS_SHELL_LIB_DIR:-${RATIS_SHELL_HOME}/jars}"
if [[ -e "${RATIS_SHELL_CONF_DIR}/ratis-shell-env.sh" ]]; then
. "${RATIS_SHELL_CONF_DIR}/ratis-shell-env.sh"
@@ -58,6 +59,16 @@ if [[ ${JAVA_MAJORMINOR} != 001008 && ${JAVA_MAJOR} != 011 ]]; then
exit 1
fi
+local RATIS_SHELL_CLASSPATH
+
+while read -d '' -r jarfile ; do
+ if [[ "$RATIS_SHELL_CLASSPATH" == "" ]]; then
+ RATIS_SHELL_CLASSPATH="$jarfile";
+ else
+ RATIS_SHELL_CLASSPATH="$RATIS_SHELL_CLASSPATH":"$jarfile"
+ fi
+done < <(find "$RATIS_SHELL_LIB_DIR" ! -type d -name '*.jar' -print0 | sort -z)
+
RATIS_SHELL_CLIENT_CLASSPATH="${RATIS_SHELL_CONF_DIR}/:${RATIS_SHELL_CLASSPATH}:${RATIS_SHELL_ASSEMBLY_CLIENT_JAR}"
if [[ -n "${RATIS_SHELL_HOME}" ]]; then