Building the OJB Console

The ultimate goal is to build a .war that contains your OJB repository configuration files, as well as your classes and jar files.

  1. Modify Build Properties

    You must modify the build.properties file. Please see the contents of that file to determine which properties need modification. But, for example, you must point the build to your servlet engine's servlet.jar file containing the javax.servlet packages.

    If you wish to keep a properties file in another location that takes precedence, the build looks for a objc_build.properties in your $HOME directory first. See the build.xml for more information.



  2. Add your OJB files and classes

    When packaging the .war file, the build will pick up the files in the etc/ojb directory and place them in the war for you. This facilitates packaging the .war with your files.

    You must replace the repository.xml files in the etc/ojb directory. The OJB console manages the objects in your repository.

    Also, add your .class or .jar files to the etc/ojb/classes and etc/ojb/lib directory, respectively. The .class or .jar files you place here should be the ones that represent the objects defined in your repository.xml. They are added ti the WEB-INF/classes and WEB-INF/lib directory of the packaged .war during the build.

    If desired, modify the OJB.propertes file

    If you are updating from cvs regularly, you may wish to override the property custom.ojb and place the properties file in your home directory named ojbc_build.properties. Checkout the build.xml to see how this works.



  3. Building the web application

    Now, you are ready to build the console.

          ant build-war
    
    This should complete successfully and leave a file ojbc.war in the build/wars directory.

    Other Build Information

    To see other available targets you can type
          ant -projecthelp
    
    You may see something similar to this:
    $ ant -projecthelp
    Buildfile: build.xml
    Main targets:
    
     build-release  Builds a sourceforge release. Probably not what you want
     build-war      Build the classes, create the jars, and packages a war
     clean          Cleans the build directory
     clean-codegen  Removes code from the code generated packages
     codegen        Generates the generated source code
     compile        Compiles java classes
     dist           Creates a distribution directory for a release
     docs           Builds the javadocs
     jar            Packages the jar from the compiled classes
     prepare        Create  for the build process
     release        Creates release files from the distribution directory.
     war            Packages the war
    
    Default target: build-war
    
    Here is some sample output from a successful build. (Note: this should be similar but probably not identical).
    $ ant build-war
    Buildfile: build.xml
    
    prepare:
         [echo] JDK: 1.4
         [echo] C:\Documents and Settings\alexander
         [echo] c:/Programs/apache/tomcat/common/lib/servlet.jar
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build\classes
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build\jars
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build\docs
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build\wars
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build\dist
        [mkdir] Created dir: E:\cvs\src\eclipse\workspace\ojbc-main\build\releases
    
    compile:
        [javac] Compiling 264 source files to E:\cvs\src\eclipse\workspace\ojbc-main\build\classes
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -deprecation for details.
    
    jar:
          [jar] Building jar: E:\cvs\src\eclipse\workspace\ojbc-main\build\jars\ojbc.jar
    
    war:
          [war] Building war: E:\cvs\src\eclipse\workspace\ojbc-main\build\wars\ojbc.war
    
    build-war:
    
    BUILD SUCCESSFUL
    Total time: 20 seconds
    

    Copyright © 2003 Alexander Bibighaus et al. All rights Reserved.