DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38914>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38914

           Summary: ant -p doesn't display targets correctly when
                    CLASSPATH=""
           Product: Ant
           Version: 1.6.5
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


OS: Cmd line prompt on Windows XP Home, SP1

Other environment variables:

ANT_HOME=C:\apache-ant-1.6.5
JAVA_HOME=C:\jdk1.5.0_04
JBOSS_HOME=C:\jboss-4.0.3SP1
JBOSS_HOME_OLD=C:\jboss-4.0.2
JDK_HOME=C:\jdk1.5.0_04
Path=C:\apache-ant-1.6.5\bin;C:\jdk1.5.0_04\bin;C:\Perl\bin\;c:\My Program
Files\mks\mksnt;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\Common Files\Adaptec Shared\System;c:\My Program Files\cwibin;"C:\Program
Files\Norton SystemWorks\Norton
Ghost\";C:\apache-ant-1.6.5\bin;C:\jdk1.5.0_04\bin;C:\Perl\bin\;c:\My Program
Files\mks\mksnt;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\Common Files\Adaptec Shared\System;c:\My Program Files\cwibin;"C:\Program
Files\Norton SystemWorks\Norton Ghost\";C:\apache-ant-1.6.5\bin;.

Build.xml file:
--------------- BEG build.xml ---------
<project default="compile">

        <target name="init" description="initialization stuff">
                <echo>FAKE init step</echo>
        </target>
        
        <target name="compile" description="compile java stuff step"
                depends="init">
                <echo>FAKE compile step</echo>
        </target>

</project>
--------------- END build.xml ---------

Repeat by:

1. "ant -p" WORKS
        set classpath="c:\jdk1.5.0_04\lib\tools.jar"  
        set classpath
CLASSPATH="c:\jdk1.5.0_04\lib\tools.jar" 
        ant -p
        // works.. displays the 2 targets
--------- BEG ANT OUTPUT -----------------
Buildfile: build.xml

Main targets:

 compile  compile java stuff step
 init     initialization stuff
Default target: compile
--------- END ANT OUTPUT -----------------

2. "ant -p" FAILS

        set classpath=""
        set classpath
CLASSPATH=""
        ant -p
        // fails.. actually runs the echo steps inside the ant file
--------- BEG ANT OUTPUT -----------------
Buildfile: build.xml

init:
     [echo] FAKE init step

compile:
     [echo] FAKE compile step

BUILD SUCCESSFUL
Total time: 0 seconds
--------- END ANT OUTPUT -----------------

        
3. INTERESTING OBSERVATION.
   (another ant option broken)
   When CLASSPATH="", then
        ant -?
   fails to display help usage, and behaves like I typed "ant"
   to run a build. So when CLASSPATH="", not only is "ant -p" flawed,
   but so is "ant -?" command.


4. MY QUESTION FOR THE ANT DEVELOPERS:

So maybe ant should look at the CLASSPATH env string manually
to see if it looks reasonable ??

Or do some API call that could indirectly tell if the tools.jar
is in the classpath?  (The code in the commons logging API
appears to do something like this.. but I am confused by it..it is too
advanced stuff for me ).

I was reading on the web somewhere that ant requires the tools.jar
file in the classpath.. well, if this is the case.. why doesn't
ant complain when CLASSPATH="" , since tools.jar is not there ???
Hmmm... strange ... indeed.

5. PS: I checked the book:
        "Ant - The definitive Guide" 2nd edition of book (page 3),
        and they don't mention anything about setting the
        CLASSPATH enviroment variable ....

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to