HBASE-26871 shaded mapreduce and shaded byo-hadoop client artifacts contain no classes (#4279)

- revert poms for both modules
- add a test to the shaded artifact validation that checks for java classes

Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
Sean Busbey 2022-03-26 11:02:08 -05:00 committed by GitHub
parent c73ef2c0c8
commit bd5b447322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 506 additions and 410 deletions

View File

@ -114,6 +114,10 @@ declare -i bad_artifacts=0
declare -a bad_contents declare -a bad_contents
for artifact in "${artifact_list[@]}"; do for artifact in "${artifact_list[@]}"; do
bad_contents=($(jar tf "${artifact}" | grep -v -E "${allowed_expr}" || true)) bad_contents=($(jar tf "${artifact}" | grep -v -E "${allowed_expr}" || true))
class_count=$(jar tf "${artifact}" | grep -c -E '\.class$' || true)
if [ ${#bad_contents[@]} -eq 0 ] && [ "${class_count}" -lt 1 ]; then
bad_contents=("The artifact contains no java class files.")
fi
if [ ${#bad_contents[@]} -gt 0 ]; then if [ ${#bad_contents[@]} -gt 0 ]; then
echo "[ERROR] Found artifact with unexpected contents: '${artifact}'" echo "[ERROR] Found artifact with unexpected contents: '${artifact}'"
echo " Please check the following and either correct the build or update" echo " Please check the following and either correct the build or update"

View File

@ -53,9 +53,8 @@
</build> </build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hbase</groupId>
<artifactId>hadoop-auth</artifactId> <artifactId>hbase-client</artifactId>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@ -69,8 +68,7 @@
<activation> <activation>
<property> <property>
<!--Below formatting for dev-support/generate-hadoopX-poms.sh--> <!--Below formatting for dev-support/generate-hadoopX-poms.sh-->
<!--h2--> <!--h2--><name>!hadoop.profile</name>
<name>!hadoop.profile</name>
</property> </property>
</activation> </activation>
<dependencies> <dependencies>

View File

@ -71,9 +71,100 @@
artifact, so we list them below in hadoop specific profiles. artifact, so we list them below in hadoop specific profiles.
--> -->
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hbase</groupId>
<artifactId>hadoop-common</artifactId> <artifactId>hbase-mapreduce</artifactId>
<scope>provided</scope> <exclusions>
<!-- Jaxb-api is a part of Java SE now -->
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
<!-- Jersey not used by our MR support -->
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-guice</artifactId>
</exclusion>
<!-- Jetty not used by our MR support -->
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-security</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util-ajax</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
</exclusion>
<!-- We excluded the server-side generated classes for JSP, so exclude
their runtime support libraries too
-->
<exclusion>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
@ -88,8 +179,7 @@
<activation> <activation>
<property> <property>
<!--Below formatting for dev-support/generate-hadoopX-poms.sh--> <!--Below formatting for dev-support/generate-hadoopX-poms.sh-->
<!--h2--> <!--h2--><name>!hadoop.profile</name>
<name>!hadoop.profile</name>
</property> </property>
</activation> </activation>
<dependencies> <dependencies>

View File

@ -114,6 +114,10 @@ declare -i bad_artifacts=0
declare -a bad_contents declare -a bad_contents
for artifact in "${artifact_list[@]}"; do for artifact in "${artifact_list[@]}"; do
bad_contents=($(jar tf "${artifact}" | grep -v -E "${allowed_expr}" || true)) bad_contents=($(jar tf "${artifact}" | grep -v -E "${allowed_expr}" || true))
class_count=$(jar tf "${artifact}" | grep -c -E '\.class$' || true)
if [ ${#bad_contents[@]} -eq 0 ] && [ "${class_count}" -lt 1 ]; then
bad_contents=("The artifact contains no java class files.")
fi
if [ ${#bad_contents[@]} -gt 0 ]; then if [ ${#bad_contents[@]} -gt 0 ]; then
echo "[ERROR] Found artifact with unexpected contents: '${artifact}'" echo "[ERROR] Found artifact with unexpected contents: '${artifact}'"
echo " Please check the following and either correct the build or update" echo " Please check the following and either correct the build or update"