我跟随getting started guide的bootique.io,我似乎遇到了一些可能与我的maven配置相关的内容,或者可能与bootique.io中最近发生的变化有关#39; t在入门指南中介绍。
我创建了一个简单的github项目,跟随指南here(git clone和mvn包,java -jar target / bootique-tryout-1-jar-with-dependencies.jar)运行)。
入门指南指出在编译和运行jar之后,您应该看到一个如下所示的选项列表:
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
选项。什么(显而易见的?)我错过了什么?
答案 0 :(得分:0)
啊,在论坛上乱后一点,我发现这是由于一些bootique特定设置处理由maven-assembly-plugin和maven-shade-plugin生成的组合jar。
我删除了基于jar-with-dependencies的maven-assembly-plugin并将其替换为maven-shade-plugin,配置如下:
<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>
当我现在mvn clean package
并尝试运行该应用程序时,我按预期看到-s, --server
选项:
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.
我已使用上述修复程序更新了my example project。