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

版权声明:本文为作者原创,转载请注明出处,联系qq:32248827 https://blog.csdn.net/dataiyangu/article/details/88137732

文章目录


原来普通的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>

猜你喜欢

转载自blog.csdn.net/dataiyangu/article/details/88137732
今日推荐