How can I compile "import pack. *" Using ant / javac if there are no such classes?

For my company, I am making a batch script package to go through and compile the latest code for our current project. I use Ant to create 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 necessary folders are imported immediately after.

It compiles fine in Eclipse, but I use Ant script to automate it outside the IDE, and Javac throws an error when it encounters this line. Is there any automatic procedure that I can use to ignore / suppress this error using javac in Ant?

I even went so far as to create a dummy file in the import directory, but all this is contained in a Jar file that I do not want to unpack and then recompress with a dummy file.

0
source share
4 answers

The presence of an empty (batch) directory will not cause an error. Ensure that the directory (root directory) of this package hierarchy is added to the class path specified 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 class path.

Or just delete the import if it imports. * from an empty directory, then it is redundant.

+1
source

What mistake?

Perhaps this is beyond the scope of your question, but have you ever thought about continuous integration solutions? We use LuntBuild and are very satisfied (there are other alternatives: CruiseControl, Hudson, QuickBuild).

0
source

Make sure you use the same version of JDK in both Eclipse and Ant. Perhaps this is the difference in the JDK versions?

The only other option is that the difference in parameters is passed to javac.

I put it first, not last.

0
source

To create Eclipse projects outside of Eclipse, see the ant4eclipse project.

0
source

Source: https://habr.com/ru/post/1494835/


All Articles