wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes past files and directories appearing in new command line ant builds Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "past files and directories appearing in new command line ant builds" Watch "past files and directories appearing in new command line ant builds" New topic
Forums: Cattle Drive Ant, Maven and Other Build Tools
Author

past files and directories appearing in new command line ant builds

Phil Freihofner
Ranch Hand

Joined: Sep 01, 2010
Posts: 115
    
    1
I am working on CattleDrive Servlets assignment 4a.

When I execute the simple command-line command: "ant" to run the build.xml file, file folders and class files from previous builds keep appearing in the resulting .war file. The build.xml that I am using is from a file "video.zip" that comes with the assignment. http://www.javaranch.com/drive/servlet/index.jsp#videos

For example, I was trying out different packages for a minimal "User.java" class I wrote in order to help understand how to address and use java classes from a JSP. In one successful experiment, I used the package name "business" for "User.java" and was able to access this from my JSP. Then, I changed the package name to "com.javaranch.drive.video" and made the appropriate changes in the JSP and again was able to instantiate a "User" class.

What I'm wondering though is this: as I continue to do builds, the directory "business" from the first experiment continues to be build by Ant in the .war file, under "WEB-INF/classes" despite the fact that there is no longer any invocations of this directory in my source and no such file in the development area. "business" has been expunged from all package references. Why does this directory and a copy of User.class continue to appear in my .war file?

I have deleted the .war file and rerun the "ant" command, I have rebooted the system, but there continues to be some sort of cache or memory that is causing these old references to appear in new .war files. What command line instructions, or what actions do I have to take so that these obsolete items are not part of the build?
Phil Freihofner
Ranch Hand

Joined: Sep 01, 2010
Posts: 115
    
    1
Further investigation: I discovered that there are files and folders in a "build" directory that are the source of the old files. Once these were deleted the .war file no longer included the obsolete past files.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2854
    
  11

That's what I was about to say. Ant doesn't have any hidden cache or anything like that, so any artifacts you see are coming from the file system. The way that build file is set up, "ant clean" will remove the build directory for you and let you start fresh.
Phil Freihofner
Ranch Hand

Joined: Sep 01, 2010
Posts: 115
    
    1
Thanks! That is what I was looking for.

Using the "clean" command will be easier and safer than deleting the files in the build directory via a file manager.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: past files and directories appearing in new command line ant builds