maven - Profile dependent web.xml -


im using force ssl configuration on production server tomcat. disable feature in development , know options are. configuration happens in web.xml file. build project using maven have few profiles id prefer set settings.

somewhere in web.xml may have following setting:

<transport-guarantee>confidential</transport-guarantee> 

if then, use property place holder transport guarantee property, , resource filter during build. replace line in web.xml like:

<transport-guarantee>${transport.guarantee}</transport-guarantee> 

you can assign default value can "confidential" property ${transport.guarantee} in pom file or external properties file, , override in dev environment giving command line argument:

mvn clean package -dtransport.guarantee="none" 

if using maven war plugin, resource filtering can enabled within pom file by:

      <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> 

finally if have make use of existing profiles set value of transport.guarantee based on profile active. 1 way this:

<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> 

you want set production profile active default setting. override , make development profile active using ~/.m2/settings.xml file.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -