1

I have a JHipster generated application with an YAML property file that looks like this:

storage:
      location: ${user.home}/my/folder

My problem is that the variable ${user.home} is resolved at build time, when I run mvn package (on Jenkins). So the property is already resolved in the resulting artifact, hence when I deploy on on my server, that path contains the resolved home of the user Jenkins. Anybody know who is doing this and why? I was expecting that the variable would be resolved at runtime.

Thanks. Valentin

4

1 回答 1

0

我不完全确定 JHipster 如何在 Spring Boot 之上构建,但我的猜测是 Maven 的资源过滤${user.home}在构建时正在扩展。默认情况下,它由spring-boot-starter-parentforapplication.propertiesapplication.yamlin启用src/main/resources

Spring Boot 问题包含更多信息,以及您可能希望进行的配置更改的详细信息,以便${…}不再过滤条目:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <encoding>UTF-8</encoding>
        <delimiters>
            <delimiter>@</delimiter>
        </delimiters>
        <useDefaultDelimiters>false</useDefaultDelimiters>
    </configuration>
</plugin> 
于 2014-09-23T15:37:56.833 回答