File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes WSAD vs. ANT Differences in class file compare Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "WSAD vs. ANT Differences in class file compare" Watch "WSAD vs. ANT Differences in class file compare" New topic
Author

WSAD vs. ANT Differences in class file compare

Michael Beauchamp
Greenhorn

Joined: Mar 03, 2005
Posts: 23
Hi,

We use WSAD to develop/maintain a fairly large web app with multiple wars. We store all of our code in a CVS repository. I wrote some ant scripts that do the following:

+ Checkout the source code

+ Run some build scripts to compile and move some files around

+ Get rid of everything that wouldn't be included in the installedApps folder on the server

+ Then I compare my new "installedApps" to what is on the server and put the difference into a staging folder.

The problem is that my class files always miscompare. What currently exists on the servers was compiled in WSAD and I am compilig with ANT using the javac task. Not being too knowledgable about Java, my assumption is that the compile process is different for Ant.

I'm using ANT 1.6.2 and WSAD 5.0 (java 1.3.1).

Any way to mimic the WSAD compile or actually use the same code?

Thanks in advance,

Mike
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
My guess is different compilers (version, build level) are being used.

From a 'ant' command line are you using one of the 'javac' compilers that are installed with WSAD? And specifically, the one which is used for your WSAD project?

Guy
Michael Beauchamp
Greenhorn

Joined: Mar 03, 2005
Posts: 23
I am definitely using a different compiler. I found a couple of examples using the JDTCompilerAdapter, but I can't seem to make it work. Here's what I have:


The error looks like this:
C:\Program Files\eclipse\workspace\ANT\Build\buildAN.xml:15: Compiler Adapter 'org.eclipse.jdt.core.JDTCompilerAdapter' can't be found.




Any help is greatly appreciated.

Thanks,

Mike
Michael Beauchamp
Greenhorn

Joined: Mar 03, 2005
Posts: 23
Update:

At this point, all signs point to a different compiler being used in WSAD than the one that Ant is using in WSAD. Using verbose, I can get info about the compiler that Ant is using.

Does anyone know how to figure out what compiler WSAD is using to compile java source?
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
In your WSAD install directories (somewhere), you will find one (or more ) 'javac.exe' files.

One of these is being used for the WSAD builds. I do not know how to figure which one is used. Search/ask about this in the Websphere forum.

You have two choices:

--Configure ant to use the same compiler as WSAD
--Vice-versa

To configure ant, just make sure that JAVA_HOME points to the WSAD compiler install directory, and that the WSAD 'bin' subdirectory is in your PATH (instead of what you currently have). Should be all there is to it.

To configure WSAD, you need to ask someone who knows how to do that - I can never figure out where to do what in WSAD, and tend to avoid using it :-). The Websphere forum again ......

Regards, Guy
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Michael - I'm running WSAD 5.1.1, so this may be different for you :-).

--Open WSAD
--Go to Window->Preferences
--Expand 'Java' if necessary
--Select 'Installed JREs'

The JRE check marked is your default JRE.

Open a DOS box, and CD to the directory of your default JRE. Then enter:

java -version

to find out what version you are running.

Back in WSAD, select the 'search' function, start at the top of your WSAD install directory, and seleck OK.

On my system, there are 5 JREs installed by WSAD, ranging from a 1.3.1 version to a 1.5 version.

You could presumably use this to find the JRE you get from the command line, and change it to be the default JRE for WSAD.

BTW - Thanks for getting me to research this. It is another case where WSAD does not do what you would expect by default.

Regards, Guy
Michael Beauchamp
Greenhorn

Joined: Mar 03, 2005
Posts: 23
Thanks, Guy. I appreciate all of your help. Unfortunately, I have to wait until Monday to try it out.
Michael Beauchamp
Greenhorn

Joined: Mar 03, 2005
Posts: 23
So.... it turns out that in WSAD I had the debug options turned on. Hence, the larger class file size.

I feel shame.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSAD vs. ANT Differences in class file compare
 
Similar Threads
Need some Guidance in using Java 1.6 with ANT
WEB-INF/classes/_pageflow folder missing using ant scripts
ant not deploying on Tomcat 7
What is ANT and what for its useful
Ant as an installer