Skip to content

Commit

Permalink
Reduce the size of neoemf-data-hbase generated artifact
Browse files Browse the repository at this point in the history
To correctly test the neoemf-data-hbase module inside the neoemf-tests module, we had to use test-scope dependencies as compile-scope ones. As a result, the generated jar was too big, i.e. > 130MB.
Now we generated a test-jar that includes all test dependencies and import it to the neoemf-tests module.
  • Loading branch information
sunye committed Jun 13, 2022
1 parent be932d8 commit 323e651
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 10 deletions.
56 changes: 46 additions & 10 deletions neoemf-data/hbase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@

<properties>
<hbase.version>2.4.12</hbase.version>
<!--
HBase MiniCluster fails to launch if hadopp.version >= 3.1.0
java.lang.IncompatibleClassChangeError:
Found interface org.apache.hadoop.hdfs.protocol.HdfsFileStatus, but class was expected
-->
<hadoop.version>3.3.3</hadoop.version><!-- Follow HBase dependencies -->
</properties>

<dependencies>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
Expand All @@ -47,15 +45,26 @@
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
<scope>compile</scope>
<scope>test</scope>
<version>${hbase.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
<scope>test</scope>
<type>test-jar</type>
<version>${hbase.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
Expand All @@ -64,7 +73,7 @@
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.8.2</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -89,7 +98,34 @@
</instructions>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/test-jar-with-dependencies.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
23 changes: 23 additions & 0 deletions neoemf-data/hbase/src/main/assembly/test-jar-with-dependencies.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>test-jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<useProjectAttachments>true</useProjectAttachments>
<unpack>false</unpack>
<scope>test</scope>
<includes>
<include>*:test-jar:*</include>
<include>*:jar:*</include>
<include>${project.groupId}:${project.artifactId}:test-jar</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>
10 changes: 10 additions & 0 deletions neoemf-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@
<scope>test</scope>
</dependency>

<!-- I don't know why, some classes are not included into neoemf-data-hbase test-jar -->
<!-- This dependency is needed to correctly test the HBase backend-->
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-testing-util</artifactId>
<type>test-jar</type>
<version>${hbase.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

</project>
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down

0 comments on commit 323e651

Please sign in to comment.