I have three targets in build.xml.
There are not errors in process.
First two runned successfully, but third don’t start and there are not war file in result.
This is my buid.xml
<?xml version="1.0" encoding="utf-8"?>
<project name="LoginProject" basedir="." default="compile">
<property name="src.dir" value="src"/>
<property name="classes.dir" value="build/classes"/>
<property name="war.dir" value="build/war"/>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile" depends="clean">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
<classpath location="lib/myfaces-api-2.0.2.jar"/>
<classpath location="lib/servlet-api.jar"/>
</javac>
</target>
<target name="war" depends="compile">
<mkdir dir="${war.dir}"/>
<war destfile="${war.dir}/loginproject.war" webxml="web/WEB-INF/web.xml">
<fileset dir="WebContent"/>
<lib dir="lib"/>
<classes dir="${classes.dir}"/>
</war>
</target>
</project>
And this is log from command line
D:\Work\Java\AntLoginProject>ant
Buildfile: D:\Work\Java\AntLoginProject\build.xml
clean:
[delete] Deleting directory D:\Work\Java\AntLoginProject\build
compile:
[mkdir] Created dir: D:\Work\Java\AntLoginProject\build\classes
[javac] Compiling 3 source files to D:\Work\Java\AntLoginProject\build\classes
BUILD SUCCESSFUL
Total time: 1 second
What wrong i do?
I change default target to war.
But now get error.
D:\Work\Java\AntLoginProject>ant war
Buildfile: D:\Work\Java\AntLoginProject\build.xml
BUILD FAILED
D:\Work\Java\AntLoginProject\build.xml:30: Content is not allowed in trailing section.
Total time: 0 seconds
Call the build as follows:
Alternatively change the default target from “compile” to “war”
Update:
The default target is changed as follows: