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?
posted 6 years ago
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.
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.
posted 6 years ago
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.