Sign up to receive your copy of the JavaRanch Journal.

productivity award
 

Sample Directory Structure

This is the sort of directory structure I see all the time:


    projectname
      /src                 // production source
        /java              // java source.  First directory in here is "com"
        /db                // database DDL (or .sql) files.
      /test                // test source
        /unit              // every class in this directory that starts with
                           //       "Test" is run as a unit test
        /functional        // every class in this directory that starts with
                           //       "Test" is run as a functional test
        /nonregression     // run stuff here manually during development
      /lib                 // jar files and the like that the project uses
        /production        // stuff that will need to be copied into production
        /development       // stuff that is used only during development
                           //        and should not find its way to production
      /build               // this dir does not go in version control.
                           //        frequently deleted and re-created by ant
        /gen-src           // if your app generates any source, it goes in here
                           //        (generated source never goes in VC!)
        /classes           // compiled production classes
        /testclasses       // compiled unit test code, functional test code,
                           //        non-regression test code, mocks, shunts, etc.
        /dist              // the final artifacts destined for production.
                           //        Usually a war file, ear file or jar file.
      build.xml            // ant build file

Folks put their unit test stuff in the same package as the production code they are testing - BUT! in a different directory structure. So if you are testing com.javaranch.Str.java found in src/java/com/javaranch/Str.java, you might have a test class com.javaranch.TestStr.java found in test/unit/com/javaranch/TestStr.java.

Comments? Questions? Rude gestures? Click here!