spring boot属性启动程序无法使用

ade*_*ood 3 spring-boot

我正在尝试使用弹簧启动属性启动器

<plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>org.springframework.boot.loader.PropertiesLauncher</mainClass>
                    </manifest>
                    <manifestEntries>
                        <Start-Class>com.att.hadoop.loader.run.Application</Start-Class>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
Run Code Online (Sandbox Code Playgroud)

当我查看清单文件时,它看起来像这样

$ unzip -q -c hdfsloader-0.0.1-SNAPSHOT.jar META-INF/MANIFEST.MF
Manifest-Version: 1.0
Built-By: aq728y
Build-Jdk: 1.7.0_25
Start-Class: org.springframework.boot.loader.PropertiesLauncher
Created-By: Apache Maven 3.1.0
Spring-Boot-Version: 1.0.0.RC1
Main-Class: org.springframework.boot.loader.JarLauncher
Archiver-Version: Plexus Archiver
Run Code Online (Sandbox Code Playgroud)

关于为什么我的mainclass和startclass错误的任何想法

我想把它设置为

Main-Class:org.springframework.boot.loader.PropertiesLauncher

Start-Class:com.att.hadoop.loader.run.Application

Dav*_*yer 13

spring-boot-maven-plugin重写你的清单,特别是它管理Main-ClassStart-Class条目,所以你必须在那里配置(不在jar插件中).该Main-Class清单中的实际上是由控制layout引导插件,例如财产

<plugin>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-maven-plugin</artifactId>
  <version>1.0.0.RC1</version>
  <configuration>
    <mainClass>${start-class}</mainClass>
    <layout>ZIP</layout>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>repackage</goal>
      </goals>
    </execution>
  </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

layout属性默认为基于归档类型(JAR或WAR)的猜测.对于PropertiesLauncher布局是"ZIP".