【发布时间】:2013-04-08 02:17:46
【问题描述】:
我从事 mavenized Java Spring Web 应用程序。我们在 Eclipse IDE 中广泛使用自动重启和热部署,但我注意到当您开始混合 maven 和 spring 配置时,Eclipse 中的集成并不好。我们希望在 web.xml 中有 maven 变量,这些变量将在项目构建期间被 maven-war-plugin 替换。
web.xml 中的 Maven 变量:
<env-entry>
<env-entry-name>spring.profiles.active</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>${profileName}</env-entry-value>
</env-entry>
在构建过程中,maven 变量被 maven-war-plugin 替换:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
</configuration>
</plugin>
此解决方案仅在我通过 maven 从命令行构建项目时才有效。 Eclipse 热部署机制显然跳过了所有那些 maven 插件...
你认为这是一个好习惯吗,有没有办法在 eclipse 中使用这种配置无缝工作?
我会适当地使用例如maven jetty 插件可以在 IDE 之外运行它,但是我不喜欢在 shell 窗口中使用控制台 - eclipse 控制台它更舒服一些。
【问题讨论】:
标签: eclipse spring maven testing configuration-files