0

I got an error when runnning target replace to xmltask:

C:\Tools\build.xml:432: The following error occurred while executing this line:
C:\Tools\build.xml:408: Failed to specify text in replace

the problem is that my coworker had no issues running the same code on his computer. I can't figure out why I got the error while my coworker didn't.

the part of build.xml is as follow:

<target name="replace" depends="init" description="replace node.">

    <xmltask source="${my-file}" dest="${my-file}"> 

        <replace path=
            "/*[local-name()='server']
              /*[local-name()='profile']
               /*[local-name() = 'subsystem'][1]" 
        withFile="${devlogfile}"/> 

    </xmltask>
</target>

<target name="init">
    <taskdef resource="net/sf/antcontrib/antcontrib.properties">
        <classpath>
            <pathelement location="${ant.lib.dir}/ant-contrib-1.0b3.jar"/>
        </classpath>
    </taskdef>
    <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
        <classpath>
            <pathelement path="${ant.lib.dir}/xmltask.jar"/>
        </classpath>
    </taskdef>
</target>

the part of property file is as follow:

my-file=c:/old.xml
devlogfile=c:/new.xml
Victor
  • 515
  • 1
  • 5
  • 10
  • What is the exact error log ? Also, did you compare the jdk and classpath in the case of your co-worker and yourself ? Iit's impossible to tell with the information given so far, but it's possible you are using different parsers. – Patrice M. Nov 14 '15 at 00:24
  • thanks for response. I updated the error log in the post. we have the same jdk version, and we have the same checked-out code, so we have same classpath. I even tried both jdk7 and jdk8, both working on my co-worker's computer, but not mine. – Victor Nov 16 '15 at 13:55
  • The error message suggests Ant doesn't find the devlogfile file itself. Are you sure the properties file is passed properly to your ant runtime ? How are you passing it ? – Patrice M. Nov 16 '15 at 17:19
  • 1
    thanks Patrice M. your suggestion fixed my problem. the issue is I checked out the code to a different location and the it was trying to find the file devlogfile in the predefined location. can you make you comment as an answer? – Victor Nov 16 '15 at 20:29

1 Answers1

1

[Converted from the comments section]

Did you compare the jdk and classpath in the case of your co-worker and yourself ? It's impossible to tell with the information given so far, but it's possible you are using different parsers.

The error message suggests Ant doesn't find the devlogfile file itself. Are you sure the properties file is passed properly to your ant runtime ? How are you passing it ?

Patrice M.
  • 4,209
  • 2
  • 27
  • 36