![](/img/trans.png)
[英]Spring boot application.properties conflict when one application deploys another
[英]Application.properties location when tomcat deploys
我在默认资源中有一个带有application.properties
的war文件。 我想在Tomcat上进行部署时,将这些属性放到/webapps/example
类的外部文件夹中,而不是/webapps/namewar
。
我可以配置我的Maven或做些什么来达到目的吗?
非常感谢。
您可以使用maven-resources-plugin的copy-resources目标将文件从源树复制到某个目录。 您需要将以下内容添加到pom.xml中:
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- you may want to choose another phase -->
<!-- see https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<!-- outputDirectory can be absolute or relative to ${basedir} -->
<outputDirectory>/webapps/example</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory><!-- or whereever your application.properties reside -->
<includes>
<include>application.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
...
</build>
...
</project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.