aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant build fail 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 "Ant build fail" Watch "Ant build fail" New topic
Author

Ant build fail

Steve Chambers
Greenhorn

Joined: Sep 19, 2006
Posts: 28
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

Joined: Dec 20, 2006
Posts: 2503
    
    8

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


OCUP UML fundamental and ITIL foundation
youtube channel
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30776
    
157

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 ]

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Steve Chambers
Greenhorn

Joined: Sep 19, 2006
Posts: 28
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

Joined: Dec 20, 2006
Posts: 2503
    
    8

${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

Joined: Jul 11, 2001
Posts: 14112
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.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Steve Chambers
Greenhorn

Joined: Sep 19, 2006
Posts: 28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant build fail