Michael,
This is terribly annoying.
Ant (or even javac, I don't know) is reporting damaged jar-files in your
classpath.
Some brave soul should find the spot and generate a better error-message.
For the time being, you can use the attached perl-script to detect the damaged
jar, which you have to fix anyhow.
-Markus
Michael Salera wrote:
> Using a build.sh and a build.xml with a <javac> task, ant is echoing a
> "count = 0, total = 17"
> on seemingly every source file in the compilation step.
>
> Anyone know of a way (without removing the <FileSet> to get rid of this?
>
> Perhaps a newbie question, pls. forgive if that's the case although I
> couldn't find a work-around on Google groups or the FAQs.
>
> Many thanks,
> Michael
>
#!/usr/local/bin/perl -w
use strict;
=pod
If there are archives in $JAVA_HOME/jre/lib/ext, they are added to the CLASSPATH.
lscp
test if all directories and archives exist.
lscp -l
show all packages
lscp -ll
show all classes
There is no warning, if a package or class is listed more than once!
=cut
$| = 1; # hot flushing
my %packages;
sub printPackageOnce {
my ($pkg) = (@_);
unless (defined $packages{$pkg}) {
print "$pkg\n";
$packages{$pkg} = 1;
}
}
# argument: a cmd how to get a list of classes.
sub getPackageOrClass{
my ($cmd) = (@_);
open (PIPE, "$cmd|");
while (<PIPE>){
if (/\.class$/) {
s|^\./||; # beautify
if (defined($ARGV[0]) && $ARGV[0] eq "-ll") {
print;
} else {
s|[^/]*$||; # strip class name
printPackageOnce($_);
}
}
}
close (PIPE);
}
#get classpath 1/2
my $ext = "$ENV{JAVA_HOME}/jre/lib/ext";
my @ext;
if (-e $ext) {
opendir(DIR, $ext);
my @files = readdir(DIR);
closedir(DIR);
foreach my $eins (@files) {
next unless ($eins =~ /\.(jar|zip)$/);
push @ext, "$ext/$eins";
}
}
#get classpath 2/2
my @classp = split /:/, $ENV{CLASSPATH};
my @all = (@ext, @classp); #combine
foreach my $eins (@all) {
%packages = (); # forget about the history....
print "------- $eins\n";
unless (-e $eins) {
print "!!!! not found !!!!\n";
next;
}
next unless (defined($ARGV[0]) && $ARGV[0] =~ /-l/);
if ($eins eq ".") {
getPackageOrClass ("ls -l *.class");
next;
}
if ($eins =~ /\.(jar|zip)$/) {
getPackageOrClass ("jar -tf $eins");
} else {
getPackageOrClass ("cd $eins ; find . -name \\*.class");
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>