You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tz...@apache.org on 2020/03/28 15:41:56 UTC

[flink-statefun] 04/13: [FLINK-16842] Use maven-shade-plugin to package ridesharing example simulator

This is an automated email from the ASF dual-hosted git repository.

tzulitai pushed a commit to branch release-2.0
in repository https://gitbox.apache.org/repos/asf/flink-statefun.git

commit 767e428354c70a7a473c644dc833a5696462d19e
Author: Tzu-Li (Gordon) Tai <tz...@apache.org>
AuthorDate: Sat Mar 28 21:42:05 2020 +0800

    [FLINK-16842] Use maven-shade-plugin to package ridesharing example simulator
    
    We need to use the maven-shade-plugin instead of the
    spring-boot-maven-plugin for packaging, since we need to add our own
    transformers that merges Apache release NOTICE files.
---
 .../Dockerfile                                     |  2 +-
 .../statefun-ridesharing-example-simulator/pom.xml | 43 ++++++++++++++++++++--
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/Dockerfile b/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/Dockerfile
index 12973cb..c8066d9 100644
--- a/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/Dockerfile
+++ b/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/Dockerfile
@@ -22,7 +22,7 @@ VOLUME /tmp
 # Make port 5656 available to the world outside this container
 EXPOSE 5656
 
-ADD target/*-simulator-*.jar simulator.jar
+ADD target/statefun-ridesharing-example-simulator-*.jar simulator.jar
 ADD application.yaml application.yaml 
 
 # Run the jar file
diff --git a/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/pom.xml b/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/pom.xml
index c312108..97d8daa 100644
--- a/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/pom.xml
+++ b/statefun-examples/statefun-ridesharing-example/statefun-ridesharing-example-simulator/pom.xml
@@ -119,16 +119,53 @@ under the License.
     <build>
         <plugins>
             <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
                 <executions>
                     <execution>
                         <phase>package</phase>
                         <goals>
-                            <goal>repackage</goal>
+                            <goal>shade</goal>
                         </goals>
+                        <configuration>
+                            <transformers>
+                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                                    <resource>META-INF/spring.handlers</resource>
+                                </transformer>
+                                <transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
+                                    <resource>META-INF/spring.factories</resource>
+                                </transformer>
+                                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+                                    <resource>META-INF/spring.schemas</resource>
+                                </transformer>
+                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>org.apache.flink.statefun.examples.ridesharing.simulator.Main</mainClass>
+                                </transformer>
+                            </transformers>
+                        </configuration>
                     </execution>
                 </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.springframework.boot</groupId>
+                        <artifactId>spring-boot-maven-plugin</artifactId>
+                        <version>2.1.6.RELEASE</version>
+                    </dependency>
+                </dependencies>
+                <configuration>
+                    <createDependencyReducedPom>false</createDependencyReducedPom>
+                    <filters>
+                        <filter>
+                            <artifact>*:*</artifact>
+                            <excludes>
+                                <exclude>META-INF/*.SF</exclude>
+                                <exclude>META-INF/*.DSA</exclude>
+                                <exclude>META-INF/*.RSA</exclude>
+                            </excludes>
+                        </filter>
+                    </filters>
+                </configuration>
             </plugin>
         </plugins>
     </build>