Troubleshooting: Package-info classes are not compiled by the build process

In certain cases, if Apache Ant 1.7.1 is used, the build process does not compile package-info.java files.

Problem

The javac Ant task employs specific code logic to handle package-info.java. In Apache Ant 1.7.1, the logic includes package-info.java for compilation only if one of the following conditions are met:

  1. package-info.class already exists in the output directory at the package level.
  2. The output directory does not exist.
  3. The last modified timestamp of package-info.java is newer than that of the output directory.

For connector and EJB modules, the source directory is the same as the output directory by default (specifically, connectorModule and ejbModule). With the WebSphere Commerce Build and Deployment tool, compilation of such modules is done in such a way that the first condition would not be met. If there are other Java files in the same package as package-info.java, it is possible that the javac task will process the other Java files first. In this case, the output directory will be created (which deviates from the second condition) and its last modified timestamp will be updated as class files are generated. At this point, the output directory is always newer than package-info.java and the last condition would not be met. package-info.class is therefore not generated.

Note: If package-info.java does not contain any annotation, regardless of the above conditions, package-info.class will not be created.

Solution

The problem has been fixed in Apache Ant 1.8.0, so the solution is to upgrade to Apache Ant 1.8.0 or later.