aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes build failed due to restriction of target matching instruction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "build failed due to restriction of target matching instruction" Watch "build failed due to restriction of target matching instruction" New topic
Author

build failed due to restriction of target matching instruction

riyaz udeen
Ranch Hand

Joined: Sep 11, 2005
Posts: 66
hye everyone. I am a new bee in ant. i am using ant 1.6.5. i wrote a build file for my project(jspbook) from the book - " servlets and jsp " by jayson falkner.I exactly copied the build file from the book and placed it in my jspbook folder inside webapps under tomcat 5.5.9.

i got the message in cmd as:
"D:\Tomcat 5.5.9\webapps\jspbook\build.xml:2: The processing instruction target matching "[xX][mM][lL]" is not allowed."

here is my build.xml file:
<?xml version="1.0" ?>
<project name="jspbook" default="build" basedir=".">
<target name="build">
<echo>Starting Build [JSP BOOK - http://www.jspbook.com] </echo>
<!-- Turn Tomcat Off -->
<antcall target="tomcatOff"/>
<!--compile Everything -->
<antcall target ="compile"/>
<!--Turn Tomcat on -->
<antcall target="tomcatOn"/>
<echo>Build Finished [JSP BOOK - http://www.jspbook.com] </echo>
</target>

<target name="tomcatOff">
<echo>Turning Off Tomcat [http://www.jspbook.com]</echo>
<exec executable="bash" os="Windows">
<arg value="../../bin/shutdown.bat"/>
</exec>
<exec executable="bash" os="Linux">
<arg value="../../bin/shutdown.sh"/>
</exec>
</target>

<target name="tomcatOn">
<echo>starting Tomcat [http://www.jspbook.com]</echo>
<exec executable="bash" os="Windows">
<arg value="../../bin/startup.bat"/>
</exec>
<exec executable="bash" os="Linux">
<arg value="../../bin/startup.sh"/>
</exec>
</target>

<target name="compile">
<echo>Compiling Book's Examples [http://www.jspbook.com] </echo>
<javac
srcdir="WEB-INF/classes"
extdirs="WEB-INF/lib:../../common/lib"
classpath="../../common/lib/servlet.jar"
depreciation="yes"
verbose="no">
<include name="com/jspbook/**"/>
</javac>
</target>
</project>

Kindly tell me what is wrong and how can i trouble shoot it. thanks fo reading.
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
You can google on the error message and find a bunch of suggestions.

Make sure you don't have any spaces or blank lines before "<?xml version="1.0" ?>"

I pasted your build.xml into a new file and it works fine for me with ant 1.6.5. If I put a space or a blank line before "<?xml version="1.0" ?>"
I get the error you got.

If that doesn't work, you could try removing that line completely.
riyaz udeen
Ranch Hand

Joined: Sep 11, 2005
Posts: 66
hye carol. thank you bravo.
bharath chary
Greenhorn

Joined: Mar 16, 2012
Posts: 2
Thanks Carol Enderlin , It is true, when copying from text book or any online tutorial some special characters may be copied (which may be used for formatting in books or tutorials blogs), but we need to make sure these characters are trimmed off before pasting it into our project. some IDE's will do this automatically.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: build failed due to restriction of target matching instruction