Skip to content

解决使用 java -jar 启动应用时提示“没有主清单属性”的问题 #19

@lihengming

Description

@lihengming

因为我使用spring-boot-dependencies代替了spring-boot-starter-parent这个parent POM,解决方案见Spring Boot官方文档:

If you are not using the parent POM you can still use the plugin, however, you must additionally add an section:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>1.5.4.RELEASE</version>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我考虑了下,还是使用spring-boot-starter-parent比较好,提供了很多标准的配置,并且包含spring-boot-dependencies。当然,这样的话你就不能继承你自己的parent POM了,不过一般中小型项目一般都没有自己的parent POM,所以应该没什么关系,真的需要修改为自己的parent POM的话,也很简单,删除spring-boot-starter-parent 改为spring-boot-dependencies即可,详细说明见官方文档说明

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions