K.2. Directory Structure For Java Builds

Abuild's ant code assumes a particular directory structure for Java-based build items. The following table describes the directories abuild looks for and what they mean. All paths are relative to the build item directory. Note that abuild-java is the abuild output directory for Java builds. All directories under abuild-java are created automatically. All other directories are optional: abuild will use them if they exist but will not complain if they are missing. Note that the clean target removes the entire abuild output directory, which includes all the unused empty directories.

src/java

This directory contains java source code. Any files it contains will be compiled into class files and included in the JAR or WAR file.

src/resources

Any files contained here will be copied to the JAR file named in the abuild.jar-name property or the EAR file named in the abuild.ear-name property. Standard ant exclusions (for CM directories, editor backup files, etc.) are in effect. Files will be placed under the root of the JAR or EAR in the same relative location as they are to src/resources in the source tree.

src/web

Any files contained here will be copied to the WAR file named in the abuild.war-name property. Standard ant exclusions (for CM directories, editor backup files, etc.) are in effect. Files will be placed under the root of the WAR in the same relative location as they are to src/web in the source tree.

src/conf

Any files contained here will be added to the META-INF directory in the JAR or EAR file named in the abuild.jar-name property or abuild.ear-name property or the WEB-INF directory in the WAR file named in the abuild.war-name property.

qtest

This directory contains any qtest test suites. It must exist in order for the test target to attempt to run any qtest-based test suites.

abuild-java/src/java

This directory contains any automatically generated java code. It is created automatically by abuild's ant rules and may be populated by a generate hook from a local build file or build item hook file.

abuild-java/src/resources

This directory is created automatically by abuild's ant rules. It should be populated with any automatically generated files that are to be added to the JAR.

abuild-java/classpath

This directory is created automatically if an EAR or WAR file is being generated. If an EAR file is generated, it is populated automatically with all files in the abuild.classpath property. If a WAR file is being generated, it is populated with the jar-file versions of all the files in the abuild.classpath property. No action is required with this directory, but if necessary, a build item may create a pre-package hook to modify or rearrange the contents of that directory. This can be useful for certain EAR and WAR file construction cases. This mechanism may change in the future.

abuild-java/classes

This directory contains class files that result from compiling files in both src/java and abuild-java/src/java.

abuild-java/dist

This directory is where abuild targets place files that are intended to be used outside of this build item. Among other things, generated archive files are placed into this directory.

abuild-java/junit

This directory contains the output of junit tests.

abuild-java/junit/html

This directory contains the HTML summary of junit test output. Loading index.html from this directory into a browser will allow you to view the test results.

abuild-java/empty

This is an empty directory used to substitute in abuild's ant code for optional directories that don't exist. You should never put any files here. If you do, they will show up in generated archives in mysterious places. [66]

Most of these directory names are all made available to ant target authors through properties.



[66] If you really want to know why we do it this way, read the comments in ant/abuild.xml in your abuild distribution.