在pom.xml里配置

 

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.example.demo.DemoApplication</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

生成的包就可以在服务器上 使用命令启动:java -jar  demo.jar

相关文章:

  • 2022-01-13
  • 2022-02-07
  • 2021-10-11
  • 2021-12-26
  • 2021-09-18
  • 2021-08-26
猜你喜欢
  • 2021-07-04
  • 2022-12-23
  • 2021-11-23
  • 2021-05-14
  • 2022-01-04
相关资源
相似解决方案