ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4372] New: - Javac task always generates optional -sourcepath switch
Date Tue, 23 Oct 2001 17:41:09 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4372>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4372

Javac task always generates optional -sourcepath switch

           Summary: Javac task always generates optional -sourcepath switch
           Product: Ant
           Version: 1.4
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: scottsh@attachmate.com


Ant's Javac task seems to always cause the optional -sourcepath switch to be 
used when calling the javac compiler.  Here's an example of the problem I'm 
having.  I want to compile D:\project\src\com\abc\xxx\ThisOne.java, which has 
the following statement:  import com.abc.yyy.AnotherOne;

The following command works correctly:
javac -d D:\project\output -classpath D:\project\src -g:none 
D:\project\src\com\abc\xxx\ThisOne.java

because the compiler finds AnotherOne.java below the specified classpath.

BUT the following command generated by Ant's Javac does not work:
javac -d D:\project\output -classpath D:\project\src -g:none -sourcepath 
D:\project\src\com\abc\xxx D:\project\src\com\abc\xxx\ThisOne.java

because the compiler now can't find AnotherOne.java, since the -sourcepath 
switch is now used to search for AnotherOne.java.

I realize I could compile AnotherOne.java first and set the classpath to the 
output path, but this could be difficult in more complex situations.

It seems to me that Ant should NOT generate the optional -sourcepath switch 
unless it is specifically needed, since it changes the behavior of the compile 
process.

Incidentally, my build.xml looks like this:
<target name="xxx">
	<javac srcdir="D:\project\src\com\abc\xxx" destdir="D:\project\output">
		<classpath>
			<pathelement location="D:\project\src"/>
		</classpath>
	</javac>
</target>

Mime
View raw message