SpringBoot通过maven打包成jar,设定主清单属性。

文章目录


原来普通的jar包一直是

<build>
        <plugins>
            <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"> <!--程序入口类,main方法类-->
                                    <mainClass>com.leesin.CSDN</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


之后一直报错

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:1.2.1:shade (default) on project sc-hsf-provider: Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:1.2.1:shade for parameter resource: Cannot find 'resource' in class org.apache.maven.plugins.shade.resource.ManifestResourceTransformer -> [Help 1]

原来SpringBoot的设置主清单属性和普通的不一样

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!-- 工程主入口-->
                    <mainClass>com.aliware.edas.HSFConsumerApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
上一篇:如何关闭Android应用程序?


下一篇:【java类方法】下载Excel格式数据