Created
July 28, 2019 08:06
-
-
Save vector4wang/bb008734b70dac5c004fda16605f9e33 to your computer and use it in GitHub Desktop.
[Maven 打包最佳实践] #Maven #pom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-checkstyle-plugin</artifactId> | |
<version>3.0.0</version> | |
<executions> | |
<execution> | |
<id>validate</id> | |
<phase>validate</phase> | |
<goals> | |
<goal>check</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<configLocation>/tools/maven/checkstyle.xml</configLocation> | |
<logViolationsToConsole>true</logViolationsToConsole> | |
</configuration> | |
</plugin> | |
<?xml version="1.0"?> | |
<!-- checkstyle.xml | |
Copyright 2015 data Artisans GmbH | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
--> | |
<!DOCTYPE module PUBLIC | |
"-//Puppy Crawl//DTD Check Configuration 1.3//EN" | |
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> | |
<module name="Checker"> | |
<!-- Syntax: //CHECKSTYLE.OFF: CheckstyleModuleToDisable - Reason for deactivation. --> | |
<!-- //CHECKSTYLE.ON: CheckstyleModuleToReEnable --> | |
<module name="SuppressionCommentFilter"> | |
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+) - (.+)"/> | |
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/> | |
<property name="checkFormat" value="$1"/> | |
</module> | |
<module name="FileLength"> | |
<property name="max" value="2500"/> | |
</module> | |
<module name="TreeWalker"> | |
<!--<module name="RegexpSinglelineJava">--> | |
<!--<property name="format" value="^\t* +\t*\S" />--> | |
<!--<property name="message"--> | |
<!--value="Line has leading space characters; indentation should be performed with tabs only." />--> | |
<!--<property name="ignoreComments" value="true" />--> | |
<!--</module>--> | |
<module name="AvoidStarImport" /> | |
<module name="UnusedImports"> | |
<!-- Allow imports for JavaDocs --> | |
<property name="processJavadoc" value="true"/> | |
</module> | |
<module name="NeedBraces"> | |
<property name="tokens" value="LITERAL_IF, LITERAL_ELSE"/> | |
</module> | |
<module name="ArrayTypeStyle" /> | |
<module name="FileContentsHolder"/> | |
<!-- <module name="ConstantName" /> | |
<module name="LocalFinalVariableName" /> | |
<module name="LocalVariableName" /> | |
<module name="MemberName" /> | |
<module name="MethodName" /> | |
<module name="PackageName" /> | |
<module name="ParameterName" /> | |
<module name="StaticVariableName" /> | |
<module name="TypeName" /> | |
<module name="AvoidStarImport" /> | |
<module name="RedundantImport" /> | |
<module name="UnusedImports" /> | |
<module name="MethodLength" /> | |
<module name="ParameterNumber" /> | |
<module name="AvoidNestedBlocks" /> | |
<module name="EmptyBlock" /> | |
<module name="LeftCurly" /> | |
<module name="NeedBraces" /> | |
<module name="RightCurly" /> | |
<module name="EmptyStatement" /> | |
<module name="EqualsHashCode" /> | |
<module name="IllegalInstantiation" /> | |
<module name="MissingSwitchDefault" /> | |
<module name="RedundantThrows" /> | |
<module name="SimplifyBooleanExpression" /> | |
<module name="SimplifyBooleanReturn" /> | |
<module name="HideUtilityClassConstructor" /> | |
<module name="InterfaceIsType" /> | |
<module name="VisibilityModifier" /> | |
<module name="ArrayTypeStyle" /> | |
<module name="UpperEll" /> --> | |
</module> | |
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- We use the maven-shade plugin to create a fat jar that contains all dependencies | |
except flink and it's transitive dependencies. The resulting fat-jar can be executed | |
on a cluster. Change the value of Program-Class if your program entry point changes. --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>2.4.1</version> | |
<executions> | |
<!-- Run shade goal on package phase --> | |
<execution> | |
<phase>package</phase> | |
<goals> | |
<goal>shade</goal> | |
</goals> | |
<configuration> | |
<artifactSet> | |
<excludes> | |
<!-- This list contains all dependencies of flink-dist | |
Everything else will be packaged into the fat-jar | |
--> | |
<exclude>org.apache.flink:flink-annotations</exclude> | |
<exclude>org.apache.flink:flink-shaded-hadoop2</exclude> | |
<exclude>org.apache.flink:flink-shaded-curator-recipes</exclude> | |
<exclude>org.apache.flink:flink-core</exclude> | |
<exclude>org.apache.flink:flink-java</exclude> | |
<exclude>org.apache.flink:flink-scala_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-runtime_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-optimizer_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-clients_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-avro_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-examples-batch_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-examples-streaming_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-streaming-java_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-streaming-scala_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-scala-shell_${scala.binary.version}</exclude> | |
<exclude>org.apache.flink:flink-python</exclude> | |
<exclude>org.apache.flink:flink-metrics-core</exclude> | |
<exclude>org.apache.flink:flink-metrics-jmx</exclude> | |
<exclude>org.apache.flink:flink-statebackend-rocksdb_${scala.binary.version}</exclude> | |
<!-- Also exclude very big transitive dependencies of Flink | |
WARNING: You have to remove these excludes if your code relies on other | |
versions of these dependencies. | |
--> | |
<exclude>log4j:log4j</exclude> | |
<exclude>org.scala-lang:scala-library</exclude> | |
<exclude>org.scala-lang:scala-compiler</exclude> | |
<exclude>org.scala-lang:scala-reflect</exclude> | |
<exclude>com.data-artisans:flakka-actor_*</exclude> | |
<exclude>com.data-artisans:flakka-remote_*</exclude> | |
<exclude>com.data-artisans:flakka-slf4j_*</exclude> | |
<exclude>io.netty:netty-all</exclude> | |
<exclude>io.netty:netty</exclude> | |
<exclude>commons-fileupload:commons-fileupload</exclude> | |
<exclude>org.apache.avro:avro</exclude> | |
<exclude>commons-collections:commons-collections</exclude> | |
<exclude>org.codehaus.jackson:jackson-core-asl</exclude> | |
<exclude>org.codehaus.jackson:jackson-mapper-asl</exclude> | |
<exclude>com.thoughtworks.paranamer:paranamer</exclude> | |
<exclude>org.xerial.snappy:snappy-java</exclude> | |
<exclude>org.apache.commons:commons-compress</exclude> | |
<exclude>org.tukaani:xz</exclude> | |
<exclude>com.esotericsoftware.kryo:kryo</exclude> | |
<exclude>com.esotericsoftware.minlog:minlog</exclude> | |
<exclude>org.objenesis:objenesis</exclude> | |
<exclude>com.twitter:chill_*</exclude> | |
<exclude>com.twitter:chill-java</exclude> | |
<exclude>commons-lang:commons-lang</exclude> | |
<exclude>junit:junit</exclude> | |
<exclude>org.apache.commons:commons-lang3</exclude> | |
<exclude>org.slf4j:slf4j-api</exclude> | |
<exclude>org.slf4j:slf4j-log4j12</exclude> | |
<exclude>log4j:log4j</exclude> | |
<exclude>org.apache.commons:commons-math</exclude> | |
<exclude>org.apache.sling:org.apache.sling.commons.json</exclude> | |
<exclude>commons-logging:commons-logging</exclude> | |
<exclude>commons-codec:commons-codec</exclude> | |
<exclude>com.fasterxml.jackson.core:jackson-core</exclude> | |
<exclude>com.fasterxml.jackson.core:jackson-databind</exclude> | |
<exclude>com.fasterxml.jackson.core:jackson-annotations</exclude> | |
<exclude>stax:stax-api</exclude> | |
<exclude>com.typesafe:config</exclude> | |
<exclude>org.uncommons.maths:uncommons-maths</exclude> | |
<exclude>com.github.scopt:scopt_*</exclude> | |
<exclude>commons-io:commons-io</exclude> | |
<exclude>commons-cli:commons-cli</exclude> | |
</excludes> | |
</artifactSet> | |
<filters> | |
<filter> | |
<artifact>org.apache.flink:*</artifact> | |
<excludes> | |
<!-- exclude shaded google but include shaded curator --> | |
<exclude>org/apache/flink/shaded/com/**</exclude> | |
<exclude>web-docs/**</exclude> | |
</excludes> | |
</filter> | |
<filter> | |
<!-- Do not copy the signatures in the META-INF folder. | |
Otherwise, this might cause SecurityExceptions when using the JAR. --> | |
<artifact>*:*</artifact> | |
<excludes> | |
<exclude>META-INF/*.SF</exclude> | |
<exclude>META-INF/*.DSA</exclude> | |
<exclude>META-INF/*.RSA</exclude> | |
</excludes> | |
</filter> | |
</filters> | |
<!-- If you want to use ./bin/flink run <quickstart jar> uncomment the following lines. | |
This will add a Main-Class entry to the manifest file --> | |
<!-- | |
<transformers> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | |
<mainClass>org.apache.flink.quickstart.StreamingJob</mainClass> | |
</transformer> | |
</transformers> | |
--> | |
<!-- todo --> | |
<transformers> | |
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | |
<!--<mainClass>com.dataartisans.flinktraining.base.topn.HotItems</mainClass>--> | |
<mainClass>com.dataartisans.flinktraining.base.batch.WordCountExample</mainClass> | |
</transformer> | |
</transformers> | |
<createDependencyReducedPom>false</createDependencyReducedPom> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment