Why not use the default jboss deploy directory?
Out of the box, jboss has a bunch of .sar, .war, and .jar deployment artifacts as well as a bunch of xml files in the default deploy directory (whose path is “jboss-install-dir/server/configured-server-instance/deploy”). For the sake of being neat and cautious, I prefer to break out any deployment artifacts that are constantly in development to a separate external directory where I would never be able to “accidentally” delete all the other important configuration files required by jboss to run. Something like that never happened to me, but a friend. Yeah, a friend. About the only thing I feel ok with leaving in the default deploy directory are the “-ds” files that map the database configurations for the instance. These database settings rarely if ever change so it abides by the “deploy moving targets to an external directory” school of thought.
Ok, I want to deploy and external directory. How do I set it up?
Well, the answer depends on which version of JBoss you are running. In general, the process is twofold: first we’ll want to locate the deployment folder configuration and then add our own entry to the list of directories JBoss inspects for deployable artifacts. If we hardcode this location, we won’t need a second step. If we want this external directory to be parameterized though, we’ll need to make sure the edits we make to the configuration match the input parameter’s name for substitution.
JBoss 5.1
Open up the profile.xml file:
[root@bedrock ~]# vim /jboss-root/server/instance/conf/bootstrap/profile.xml
You’re going to want to add a line like the following:
<bean name="BootstrapProfileFactory"
class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
...
<property name="applicationURIs">
<list elementClass="java.net.URI">
<value>${jboss.server.home.url}/deploy</value>
<value>file:/c:/external/location/deploy/directory/path</value>
<value>${external.deploy.dir}/deploy</value>
</list>
</property>
...
</bean>
You’ll notice the two ant script like looking variables in the list. The first one ${jboss.server.home.url}, declares the JBoss server’s default deploy location. The other one ${external.deploy.dir}, is a parameterized version of an externalized deploy directory. If you use this second style, you’ll need to make sure to pass in a parameter in the format “-Dexternal.deploy.dir=file:/c:/external/location”. This will pass in the value so the substitution will provide a fully qualified URL to scan for deployments. Note, however if the parameterized version does not satisfy a reachable location, JBoss will continuously attempt to deploy that location if you have hot deploy and/or deployment scanner enabled (these services will attempt to periodically attempt to scan deployment directories for new deployments).
Save the file, and fire up jboss, and you’re good to go.
Related posts:
Comments (0)