Experimenting with maven-shade-plugin to create a fat-jar of the postgres dependency.

Will have to do this for all plugins. Currently, it's not registering the plugin with the SpringPluginManager
This commit is contained in:
Arpit Mohan 2020-06-10 11:11:23 +00:00
parent f00c9c23c8
commit 01737b9599
10 changed files with 119 additions and 59 deletions

View File

@ -0,0 +1,5 @@
plugin.id=mongo-plugin
plugin.class=com.external.plugins.MongoPlugin
plugin.version=1.0-SNAPSHOT
plugin.provider=tech@appsmith.com
plugin.dependencies=

View File

@ -23,23 +23,19 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.pf4j</groupId> <groupId>org.pf4j</groupId>
<artifactId>pf4j-spring</artifactId> <artifactId>pf4j-spring</artifactId>
<version>0.5.0</version> <version>0.6.0</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.appsmith</groupId> <groupId>com.appsmith</groupId>
<artifactId>interfaces</artifactId> <artifactId>interfaces</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -54,6 +50,14 @@
<version>3.11.1</version> <version>3.11.1</version>
</dependency> </dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>io.projectreactor</groupId> <groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId> <artifactId>reactor-test</artifactId>
@ -77,25 +81,31 @@
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.1.2</version> <version>3.2.4</version>
<configuration> <configuration>
<archive> <minimizeJar>false</minimizeJar>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries> <manifestEntries>
<Plugin-Id>${plugin.id}</Plugin-Id> <Plugin-Id>${plugin.id}</Plugin-Id>
<Plugin-Class>${plugin.class}</Plugin-Class> <Plugin-Class>${plugin.class}</Plugin-Class>
<Plugin-Version>${plugin.version}</Plugin-Version> <Plugin-Version>${plugin.version}</Plugin-Version>
<Plugin-Provider>${plugin.provider}</Plugin-Provider> <Plugin-Provider>${plugin.provider}</Plugin-Provider>
<Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies>
</manifestEntries> </manifestEntries>
</archive> </transformer>
</transformers>
</configuration> </configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -0,0 +1,5 @@
plugin.id=postgres-plugin
plugin.class=com.external.plugins.PostgresPlugin
plugin.version=1.0-SNAPSHOT
plugin.provider=tech@appsmith.com
plugin.dependencies=

View File

@ -23,23 +23,19 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.pf4j</groupId> <groupId>org.pf4j</groupId>
<artifactId>pf4j-spring</artifactId> <artifactId>pf4j-spring</artifactId>
<version>0.5.0</version> <version>0.6.0</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.appsmith</groupId> <groupId>com.appsmith</groupId>
<artifactId>interfaces</artifactId> <artifactId>interfaces</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -53,6 +49,15 @@
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.2.12</version> <version>42.2.12</version>
<scope>runtime</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -78,30 +83,37 @@
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId> <artifactId>mockito-core</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>3.1.2</version> <version>3.2.4</version>
<configuration> <configuration>
<archive> <minimizeJar>false</minimizeJar>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries> <manifestEntries>
<Plugin-Id>${plugin.id}</Plugin-Id> <Plugin-Id>${plugin.id}</Plugin-Id>
<Plugin-Class>${plugin.class}</Plugin-Class> <Plugin-Class>${plugin.class}</Plugin-Class>
<Plugin-Version>${plugin.version}</Plugin-Version> <Plugin-Version>${plugin.version}</Plugin-Version>
<Plugin-Provider>${plugin.provider}</Plugin-Provider> <Plugin-Provider>${plugin.provider}</Plugin-Provider>
<Plugin-Dependencies>${plugin.dependencies}</Plugin-Dependencies>
</manifestEntries> </manifestEntries>
</archive> </transformer>
</transformers>
</configuration> </configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -0,0 +1,5 @@
plugin.id=rapidapi-plugin
plugin.class=com.external.plugins.RapidApiPlugin
plugin.version=1.0-SNAPSHOT
plugin.provider=tech@appsmith.com
plugin.dependencies=

View File

@ -4,6 +4,13 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.external.plugins</groupId> <groupId>com.external.plugins</groupId>
<artifactId>rapidApiPlugin</artifactId> <artifactId>rapidApiPlugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
@ -23,23 +30,19 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.pf4j</groupId> <groupId>org.pf4j</groupId>
<artifactId>pf4j-spring</artifactId> <artifactId>pf4j-spring</artifactId>
<version>0.5.0</version> <version>0.6.0</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.appsmith</groupId> <groupId>com.appsmith</groupId>
<artifactId>interfaces</artifactId> <artifactId>interfaces</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -55,8 +58,20 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<!--
This doesn't use the maven-shade-plugin because it inherits from spring-boot-starter-parent
for it's dependency on webclient. This is a normal compile.
-->
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -0,0 +1,5 @@
plugin.id=restapi-plugin
plugin.class=com.external.plugins.RestApiPlugin
plugin.version=1.0-SNAPSHOT
plugin.provider=tech@appsmith.com
plugin.dependencies=

View File

@ -30,23 +30,19 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.pf4j</groupId> <groupId>org.pf4j</groupId>
<artifactId>pf4j-spring</artifactId> <artifactId>pf4j-spring</artifactId>
<version>0.5.0</version> <version>0.6.0</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.appsmith</groupId> <groupId>com.appsmith</groupId>
<artifactId>interfaces</artifactId> <artifactId>interfaces</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -68,6 +64,13 @@
</dependency> </dependency>
<!-- Test dependencies --> <!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>io.projectreactor</groupId> <groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId> <artifactId>reactor-test</artifactId>
@ -84,6 +87,10 @@
</dependencies> </dependencies>
<!--
This doesn't use the maven-shade-plugin because it inherits from spring-boot-starter-parent
for it's dependency on webclient. This is a normal compile.
-->
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -114,11 +114,6 @@
<artifactId>de.flapdoodle.embed.mongo</artifactId> <artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# Remove previous dist directory # Remove previous dist directory
rm -rf dist/
# Build the code. $@ accepts all the parameters from the input command line and uses it in the maven build command # Build the code. $@ accepts all the parameters from the input command line and uses it in the maven build command
mvn clean package "$@" mvn clean package "$@"
@ -12,7 +13,7 @@ mkdir -p dist/plugins
cp ./appsmith-server/target/server-1.0-SNAPSHOT.jar dist/ cp ./appsmith-server/target/server-1.0-SNAPSHOT.jar dist/
# Copy all the plugins # Copy all the plugins
cp ./appsmith-plugins/*/target/*.jar dist/plugins/ rsync -av --exclude "original-*.jar" ./appsmith-plugins/*/target/*.jar dist/plugins/