java - Issue writing out file path properties in ant -


I am having a problem with writing a property that holds the value of the directory path in the property file.

My script basically reads in this special property, it is called 'appserver.home', & lt; Property file = "source.props" /> and & gt; by using a prom file. I echoed the incoming value and read it correctly as C: \\ somedir \\ jboss_4_2_3.

What does my script need to do next? This value is used by another property file (another ant script - though this is not important). To create this other file, I am using an off-template file in a way that is surrounded by $ $ .... with placeholders, to put the right place in the right places using the following: -

  & lt; Copy file = "template_file.props" tofile = "target.props" & gt; & Lt; Filterset begintoken = "$" endtoken = "$" & gt; & Lt; Filter token = "appServerDir" value = "$ {appserver.home}" /> & Lt; Filter token = "dbusername" value = "$ {database.name}" /> .... & lt; / Filteret & gt; & Lt; / Copy & gt;  

The problem is that the value is now in the value C: \ somedir \ jboss_4_2_3 i.e. lost it to the surviving characters. When the next ant script uses this file, it interprets the value of the property in the form of C: somedirjboss_4_2_3 .

So the question is how can I tell the ant that the value I am writing is a file path? Note I have tried the following, which actually works: -

  & lt; Propertyfile file = "target.props" & gt; & Lt; Entry key = "Appsaver Deer" value = "$ {appserver.home}" /> & Lt; / Propertyfile & gt;  

.. This name denotes c \: \\ somedir \\ jboss4_2_3 , but I do not want to use this technique nor It is a template file technique because it has some properties that are always stable, as well as comments etc.

Thanks in advance

When you say 'appserver.home' correctly If you fall, I think that you are using 'apoparties' work which shows you the saved value without escaping. And it shows the same passions as your 'source.props' file.

The problem is that, generally, when the ant moves this value into a string, then it will be saved, so they disappear. An exception to this is in the 'attribute' function, where you usually want to keep the output in the property file - as you have seen - so that the file can be read properly later.

So, what to do?

Perhaps the simplest thing is to make sure that 'source' The properties obtained from 'suppresses' should be retained for use in subsequent filters. Therefore

  & lt; Property file = "source.props" /> Use  

to load instead of

  & lt; Loadproperties srcfile = "source.props" & gt; & Lt; Filterchain & gt; & Lt; Replacestring = "\" from = "\\" /> & Lt; / Filterchain & gt; & Lt; / Loadproperties & gt;  

Make sure to promote your escape sequence.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -