【发布时间】:2016-07-13 02:12:28
【问题描述】:
通常我使用命令运行我的 Spring Boot 应用程序:
mvn spring-boot:run -Drun.arguments=--server.port=9090 \
-Dpath.to.config.dir=/var/data/my/config/dir
我想设置自定义端口进行调试,所以我可以从 Eclipse 连接。当我从示例中添加参数时 https://docs.spring.io/spring-boot/docs/1.1.2.RELEASE/maven-plugin/examples/run-debug.html
mvn spring-boot:run -Drun.arguments=--server.port=9090 \
-Dpath.to.config.dir=/var/data/my/config/dir \
-Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787"
它可以工作,但其他参数(如 server.port 或 path.to.config.dir)不再被识别,我得到如下异常:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed
to parse configuration class [com.my.app.Controller]; nested exception
is java.lang.IllegalArgumentException: Could not resolve placeholder
'path.to.config.dir' in string value
file:///${path.to.config.dir}/some.properties"
问题:如何在所有参数的情况下运行?
【问题讨论】:
-
就我而言,确切的解决方案是致电:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8787 -Dserver.port=9090 -Dpath.to.config.dir=/var/data/my/config/dir" -
链接失效...
-
@powder366 已修复。
标签: java spring maven spring-boot maven-3