How can I compile "import pack.*" with ant/javac, when there are no such classes?
For my company, I'm making a batch script to go through and compile the latest revisions of code for our current project. I'm using Ant to build the class files, but encountered a strange error. One of the source files imports .* from a directory, where there are no files (only folders), and in fact, the folders needed are imported right after.
It compiles perfectly fine in Eclipse, but I'm using an Ant script to automate it outside of the IDE, and Javac throws an error when it encounters this line. Is there any automated procedure I can use to ignore/suppress this error with javac in Ant?
I'd even go so far as to create a dummy file in the importing directory, but all of that in contained in a Jar file I don't wish to have to decompress and then recompress with the dummy file.
Having an empty (package) directory would not cause an error. Make sure the (root) directory of that package hierarchy is being added to the classpath specifed for javac.
eg. if the package is com.stuff and the directory is /java/src/com/stuff then you need to add /java/src to the javac classpath.
Or just remove the import, if it is importing .* from an empty directory then it is redundant.
What is the error?
Maybe this is out of the scope of your question but have you ever thought about Continuous Integration solutions? We use LuntBuild and are quite happy (other alternatives exist as well: CruiseControl, Hudson, QuickBuild).
Check to make sure you're using the same version of the JDK in both Eclipse and from Ant. Perhaps this is a difference across JDK versions?
The only other option would be that it's a difference in parameters being passed to javac.
I'm betting it's the former, not the latter.
For building Eclipse projects outside of Eclipse, have a look at the ant4eclipse project.