我正在尝试使用Spring Boot Properties Launcher
<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>
当我查看清单文件时,它看起来像这样
$ 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
为什么我的主班和入门班错了
我想将其设置为
主类:org.springframework.boot.loader.PropertiesLauncher
入门班:com.att.hadoop.loader.run.Application
spring-boot-maven-plugin重写清单,特别是它管理Main-Class和Start- Class条目,因此您必须在其中进行配置(不在jar插件中)。该Main-Class清单中的实际上是由控制layout引导插件,例如财产
Main-Class
Start- 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>
布局属性默认为基于存档类型(JAR或WAR)的猜测。对于PropertiesLauncher布局是“ ZIP”。
PropertiesLauncher