• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant build fail

 
Steve Chambers
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am adding uncompilable code to a .java file and when I run the ant build script it still completes with "BUILD SUCCESSFUL" Can someone glance over this command and tell me if I am missing anything?

<javac srcdir="${source.dir}" destdir="${build.dir}" optimize="true" debug="true" fork="true" memoryMaximumSize="256m" target="1.4">
<include name="devCode/*.java" />
 
Jan Cumps
Bartender
Posts: 2599
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try source="1.4".

target="1.4" makes your compiled classes suitable to be executed by a 1.4 runtime (the switch defines the binary format), while source="1.4" checks for language features incompatible with 1.4 (the switch validates the source format).

Maybe you still have compiled classes in your ${build.dir}. Clear them first.

Regards, Jan
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34860
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,
You can add the attribute failonerror so the build fails if the code fails to compile.
[ March 04, 2007: Message edited by: Jeanne Boyarsky ]
 
Steve Chambers
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I run the build script I keep getting a file named ${build.dir} Should I have this variable defined somewhere else in the buildscript or in a properties file?

I did both things you guys said but the build is still successful.

Does it have something to do with the build.dir directory?
 
Jan Cumps
Bartender
Posts: 2599
12
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${build.dir} Should I have this variable defined somewhere else in the buildscript or in a properties file?
Yes. e.g. build.dir=build

This will compile your classes to a directory "build" located in your project's base dir.

Regards, Jan
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Chambers:
When I run the build script I keep getting a file named ${build.dir} Should I have this variable defined somewhere else in the buildscript or in a properties file?


Either that, or change the attribute

destdir="${build.dir}"

to a value that doesn't use that property.
 
Steve Chambers
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I get a successful build shouldn't I have class files in my build folder? I don't have anything in there when a build is successful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic