0

I need to change following xml text

<!--Authenticator name="MutualSSLAuthenticator" disabled="false">
  <Priority>5</Priority>
  <Config>
      <Parameter name="UsernameHeader">UserName</Parameter>
      <Parameter name="WhiteListEnabled">false</Parameter>
      <Parameter name="WhiteList"/>
  </Config>
</Authenticator-->

with following text using maven-antrun plugin.

<Authenticator name="MutualSSLAuthenticator" disabled="false">
  <Priority>5</Priority>
  <Config>
      <Parameter name="UsernameHeader">UserName</Parameter>
      <Parameter name="WhiteListEnabled">false</Parameter>
      <Parameter name="WhiteList"/>
  </Config>
</Authenticator>

I tried following, but it didn't work.

<replace
                                    file="../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/security/authenticators.xml"
                                    token="&lt;!--Authenticator name=&quot;MutualSSLAuthenticator&quot; disabled=&quot;false&quot;&gt;${line.separator}
  &lt;Priority&gt;5&lt;/Priority&gt;${line.separator}
  &lt;Config&gt;${line.separator}
      &lt;Parameter name=&quot;UsernameHeader&quot;&gt;UserName&lt;/Parameter&gt;${line.separator}
      &lt;Parameter name=&quot;WhiteListEnabled&quot;&gt;false&lt;/Parameter&gt;${line.separator}
      &lt;Parameter name=&quot;WhiteList&quot;/&gt;${line.separator}
  &lt;/Config&gt;${line.separator}
&lt;/Authenticator--&gt;"
                                    value="&lt;Authenticator name=&quot;MutualSSLAuthenticator&quot; disabled=&quot;false&quot;&gt;
  &lt;Priority&gt;5&lt;/Priority&gt;
  &lt;Config&gt;
      &lt;Parameter name=&quot;UsernameHeader&quot;&gt;UserName&lt;/Parameter&gt;
      &lt;Parameter name=&quot;WhiteListEnabled&quot;&gt;false&lt;/Parameter&gt;
      &lt;Parameter name=&quot;WhiteList&quot;/&gt;
  &lt;/Config&gt;
&lt;/Authenticator&gt;"/>

How can I do this? can I use some regex kind of thing with this?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Chamila Wijayarathna
  • 1,815
  • 5
  • 30
  • 54
  • Why do you need to do such thing? For tests? – khmarbaise Nov 16 '15 at 14:57
  • I need to change a configuration file at build time. – Chamila Wijayarathna Nov 16 '15 at 15:07
  • That's what i thought but do you need it for example for tests to change the configuration? – khmarbaise Nov 16 '15 at 15:36
  • So you want to remove the comments right? Well, there is surely something wrong with your design, you wouldn't want to do such a thing. This sounds like a XY problem. What do you really want to do here? What's your use-case? – Tunaki Nov 16 '15 at 15:37
  • I have a XML file which comes from a different maven project and I download it from nexus, than I need to configure it to suit my project, I'm working on https://github.com/wso2/product-is, https://github.com/wso2/product-is/blob/master/modules/distribution/pom.xml#L128 – Chamila Wijayarathna Nov 17 '15 at 04:39

0 Answers0