小编wbk*_*wbk的帖子

Maven spring boot使用参数运行调试

通常我用命令运行我的Spring Boot应用程序:

mvn spring-boot:run -Drun.arguments=--server.port=9090 \
   -Dpath.to.config.dir=/var/data/my/config/dir
Run Code Online (Sandbox Code Playgroud)

我想设置自定义端口进行调试,所以我可以从eclipse连接.当我从示例http://docs.spring.io/spring-boot/docs/1.1.2.BUILD-SNAPSHOT/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"
Run Code Online (Sandbox Code Playgroud)

它有效,但其他论点喜欢server.portpath.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"
Run Code Online (Sandbox Code Playgroud)

问题:如何运行所有参数?

java spring maven-3 maven spring-boot

30
推荐指数
3
解决办法
5万
查看次数

--add-modules仅用于编译

我正在使用maven和构建我的项目.我在我的pom.xml文件中添加了:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>${maven-compiler-plugin.version}</version>
    <configuration>
        <source>${java.version}</source>
        <target>${java.version}</target>
        <compilerArgs>
            <arg>--add-modules</arg>
            <arg>java.xml.bind</arg>
        </compilerArgs>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

但是,为了运行应用程序,我必须像这样运行它:

java -jar --add-modules java.xml.bind my-app.jar
Run Code Online (Sandbox Code Playgroud)

有没有办法构建应用程序,从命令行运行而不是--add-modules java.xml.bindjava命令行参数?

java jaxb maven maven-compiler-plugin java-9

27
推荐指数
1
解决办法
3万
查看次数