我希望Quarkus应用程序在默认端口以外的端口上运行。我该怎么办?
答案 0 :(得分:6)
要使用的Quarkus配置属性为quarkus.http.port
(默认值为8080)。
如果在application.properties
中设置了此属性,则将使用该值。
还可以在运行时重写该属性,如下所示:
在JVM模式下运行Quarkus应用程序时,可以使用quarkus.http.port系统属性设置端口。 例如:
java -Dquarkus.http.port=8081 -jar example-runner.java
相同的属性适用于GraalVM纯模式图像。 例如:
./example-runner -Dquarkus.http.port=8081
答案 1 :(得分:2)
要补充geoand的答案,您可以为mvn quarkus:dev
使用相同的属性。不幸的是,您不能直接在~/.m2/settings.xml
的配置文件中设置它,以避免每次都需要键入它(例如,因为Microk8s binds 8080),但是您可以通过{{ 1}}:
jvm.args
或者,您可以配置以下in project sources:
<profiles>
<profile>
<id>microk8s-quarkus-dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<jvm.args>-Dquarkus.http.port=8090</jvm.args>
</properties>
</profile>
</profiles>
尽管这不会在项目之间共享,并且同一项目的其他开发人员可能不想使用。