Is there a way I can "echo" the classpath that ant uses (while it is building the classes,jars, etc as per the build.xml) ? I am not changing the classpath from the build.xml file. So I guess, ant should use system's(I am on a Linux system) CLASSPATH variable.
            Asked
            
        
        
            Active
            
        
            Viewed 572 times
        
    1 Answers
3
            
            
        The environment attribute of the <property> tag reads the system environment variables and stores them in properties, (in the example below) prefixed with env.
Then, in order to print them, you can use <echo>
<property environment="env"/>
<echo message="CLASSPATH: ${env.CLASSPATH}"/>
More info:
        Community
        
- 1
 - 1
 
        Konstantin Yovkov
        
- 62,134
 - 8
 - 100
 - 147
 
- 
                    1Doesn't ANT build its own classpath for compilation though? I wouldn't expect a CLASSPATH environmental variable to have any influence on it, otherwise you'd get different results on different machines. – Gimby Nov 04 '13 at 13:39
 - 
                    Yes, you're right. But what I'm pointing in my example is that you can access the values of the system variables (and print them). And I believe that the thing the OP asks. – Konstantin Yovkov Nov 04 '13 at 13:41
 - 
                    Hmmm I see. Actually I want to "echo" the classpath that Ant uses while it is compiling (if I run it on the command line, like : **$ ant** ). Is there a way to get that ? – M-D Nov 04 '13 at 13:50
 - 
                    Yes, see my updated answer (the second link) – Konstantin Yovkov Nov 04 '13 at 13:53