您的web.xml中的某个位置可能具有以下设置:
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
如果是这样,您可以使用属性占位符作为传输保证属性,并在构建期间对资源进行过滤.用以下内容替换web.xml中的那一行:
<transport-guarantee>${transport.guarantee}</transport-guarantee>
您可以将默认值"CONFIDENTIAL"分配给pom文件或外部属性文件中的属性$ {transport.guarantee},并通过提供命令行参数在开发环境中覆盖它:
mvn clean package -Dtransport.guarantee="NONE"
如果您使用的是maven war插件,可以通过以下方式在pom文件中启用资源过滤:
      <configuration>
                <webResources>
                    <resource>
                        <filtering>true</filtering>
                        <directory>src/main/webapp</directory>
                        <includes>
                            <include>**/web.xml</include>
                        </includes>
                    </resource>
                </webResources>
                <warSourceDirectory>src/main/webapp</warSourceDirectory>
                <webXml>src/main/webapp/WEB-INF/web.xml</webXml>
            </configuration>
最后,如果您必须使用现有的配置文件,则根据哪个配置文件处于活动状态来设置transport.guarantee的值.一种方法:
<profiles>
 <profile>
  <id>development</id>
  <properties>
    <transport.guarantee>NONE</transport.guarantee>
  </properties>
</profile>
<profile>
  <id>production</id>
  <properties>
    <transport.guarantee>CONFIDENTIAL</transport.guarantee>
  </properties>
</profile>
您希望将生产配置文件设置为活动状态作为默认设置.使用〜/ .m2/settings.xml文件覆盖并使您的开发配置文件处于活动状态.
| 归档时间: | 
 | 
| 查看次数: | 792 次 | 
| 最近记录: |