Java Bootique,正在运行主示例,服务器选项未显示
我正在遵循的,我似乎遇到了一些可能与我的maven配置有关的东西,或者可能与bootique.io中最近的更改有关,这些更改在入门指南中没有介绍 我已经创建了一个简单的github项目来遵循指南(git clone和mvn包,java-jar target/bootique-tryout-1-jar-with-dependencies.jar来运行) 《入门指南》指出,编译和运行jar后,您应该会看到如下选项列表:Java Bootique,正在运行主示例,服务器选项未显示,java,Java,我正在遵循的,我似乎遇到了一些可能与我的maven配置有关的东西,或者可能与bootique.io中最近的更改有关,这些更改在入门指南中没有介绍 我已经创建了一个简单的github项目来遵循指南(git clone和mvn包,java-jar target/bootique-tryout-1-jar-with-dependencies.jar来运行) 《入门指南》指出,编译和运行jar后,您应该会看到如下选项列表: NAME com.foo.Application OPTIONS
NAME
com.foo.Application
OPTIONS
-c yaml_location, --config=yaml_location
Specifies YAML config location, which can be a file path or a URL.
-h, --help
Prints this message.
-H, --help-config
Prints information about application modules and their configuration
options.
-s, --server
Starts Jetty server.
但是,当我运行上述后续版本时,我看到:
NAME
bootique-tryout-1-jar-with-dependencies.jar
OPTIONS
-c yaml_location, --config=yaml_location
Specifies YAML config location, which can be a file path or a URL.
-h, --help
Prints this message.
-H, --help-config
Prints information about application modules and their configuration
options.
请注意缺少的
-s,--server
选项。我遗漏了什么(明显的?)东西?啊,在论坛上转了一圈后,我发现这是由于在处理maven assembly插件和maven shade插件生成的组合JAR时,某些特定于bootique的设置造成的
我删除了基于maven assembly插件的jar及其依赖项,并将其替换为maven shade插件,配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${main.class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
我已更新了上述修复程序
NAME
bootique-tryout-1.jar
OPTIONS
-c yaml_location, --config=yaml_location
Specifies YAML config location, which can be a file path or a URL.
-h, --help
Prints this message.
-H, --help-config
Prints information about application modules and their configuration
options.
-s, --server
Starts Jetty server.