Command-line Usage
To use java -DmyApp.home=/path/to/myApp \ -Dforehead.conf.file=/path/to/my/forehead.conf \ com.werken.forehead.Forehead $*
Format of forehead.confThere are 3 main features of a forehead.conf file:
Property Imports
When defining the paths and jars that are a part of the
classpath for one of your ClassLoaders, it is many times
convenient to reference a value stored in a Java system
property. For example, your script that and invokes
To make a property available within a +property.name.one +property.name.two +property.name.three For example: +myApp.home ClassLoader Definitions
Complex hierarchies of ClassLoaders may be constructed using a
ClassLoader names uses dot-notation to specify the hierarchy. A ClassLoader may only be defined after its parent has been defined. For example: +tools.jar.path +myApp.home [root] ${tools.jar.path} [root.app] ${myApp.home}/lib/myApp.jar ${myApp.home}/lib/someDependency.jar Entry-point Definition Each forehead.conf file must contain exactly 1 entry-point definition. This specifies which class should be loaded from which ClassLoader. The entry-point's normal main(String[]) method will be invoked. Additionally, the thread's context ClassLoader will be set to that which loaded the entry-point class. The syntax for an entry-point definition is as follows: = [ClassLoader name] class name For example: = [root.app] com.myco.myapp.Main Complete ExampleHere is a complete example from the jakarta-turbine-maven project: # Import some properties # +maven.home +java.home +tools.jar # Define the entry-point as: # # void org.apache.maven.app.Maven::main(String[]) # # Attempt to load through the [root.maven] # classloader, # but it may actually be loaded higher in the hierarchy # =[root.maven] org.apache.maven.app.Maven # Define a classloader named [root] # [root] # Path elements searched loaded in-order ${tools.jar} ${maven.home}/lib/grant-1.0-dev.jar ${maven.home}/lib/ant-1.4.1.jar ${maven.home}/lib/xercesImpl-2.0.0.jar ${maven.home}/lib/xmlParserAPIs-2.0.0.jar ${maven.home}/lib/ant-optional-1.4.1.jar ${maven.home}/lib/junit-3.7.jar ${maven.home}/lib/xmlParserAPIs-2.0.0.jar # Define a classloader named [root.mave], which has # [root] as a parent. # [root.maven] ${maven.home}/lib/xercesImpl-2.0.0.jar ${maven.home}/lib/commons-jelly-1.0-dev.20020614.035258.jar ${maven.home}/lib/werkz-1.0-dev.20020613.091536.jar ${maven.home}/lib/commons-logging-1.0.jar ${maven.home}/lib/log4j-1.1.3.jar ${maven.home}/lib/dom4j-1.4-dev.jar ${maven.home}/lib/commons-beanutils-1.4-dev.jar ${maven.home}/lib/commons-collections-2.0.jar ${maven.home}/lib/commons-jexl-1.0-dev.jar ${maven.home}/lib/antlr-2.7.1.jar ${maven.home}/lib/bcel-5.0.jar ${maven.home}/lib/checkstyle-2.2.jar ${maven.home}/lib/commons-betwixt-1.0-dev.jar ${maven.home}/lib/commons-cli-1.0-dev.jar ${maven.home}/lib/commons-digester-1.2.jar ${maven.home}/lib/commons-graph-0.8.jar ${maven.home}/lib/commons-io-0.1.jar ${maven.home}/lib/commons-lang-1.0-dev.jar ${maven.home}/lib/commons-util-1.0-rc2-dev.jar ${maven.home}/lib/jdepend-2.2.jar ${maven.home}/lib/logkit-1.0.1.jar ${maven.home}/lib/oro-2.0.6.jar ${maven.home}/lib/regexp-1.2.jar ${maven.home}/lib/velocity-1.4-dev.jar ${maven.home}/lib/velocity-dvsl-0.43.jar ${maven.home}/lib/maven.jar ${maven.home}/lib/commons-logging-1.0.jar ${maven.home}/lib/log4j-1.1.3.jar |