maven-assembly-plugin打包可执行的jar包

Posted 大数据从业者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven-assembly-plugin打包可执行的jar包相关的知识,希望对你有一定的参考价值。

pom.xml添加

<build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.spark.service.SparkStreamingKafka</mainClass>
                <!--project 入口-> </manifest> </archive> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <!-- <goal>assembly</goal> --> <goal>single</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <!--use commend: mvn assembly:assembly -DskipTests --> </plugins> </build>
mvn clean package                      //可生成***-jar-with-dependencies.jar与***.jar,前者即为可执行jar包

mvn clean compile assembly:single //可生成***-jar-with-dependencies.jar,即为可执行jar包



以上是关于maven-assembly-plugin打包可执行的jar包的主要内容,如果未能解决你的问题,请参考以下文章

使用maven-assembly-plugin打包zipproject

通过 maven-assembly-plugin 打包在 jar 中包含 spring xml

maven-assembly-plugin打包可执行的jar包

maven打包插件maven-assembly-plugin

Hadoop-Maven打包项目<artifactId>maven-assembly-plugin</artifactId>标红报错

Hadoop-Maven打包项目<artifactId>maven-assembly-plugin</artifactId>标红报错