deploying your EAR or WAR on JBoss 5 from another location on disk

Sometimes it is a pain in the ass to keep your crap in the deploy directory. There used to be docBase and whatnot, but that nifty stuff is ignored mostly by JBoss 5, since it's got it's own nifty way of doing things.

So, if you'd like to easily keep your code separate from your appserver (mostly a developer's want-- on production, most this crap doesn't matter), you can do this:

Edit {jboss_home}/server/{your_server}/conf/bootstrap/profile-repository.xml to have something like this:

...
<bean name="SerializableDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.SerializableDeploymentRepositoryFactory">
<property name="storeRoot">${jboss.server.base.dir}</property>
<property name="attachmentsRoot">${jboss.server.data.dir}/attachments</property>
<property name="applicationURIs">
<array elementClass="java.net.URI">
<value>${jboss.server.home.url}deploy</value>
<value>file:///path/to/your/deploy/dir</value>
</array>
</property>
<property name="serializer"><inject bean="AttachmentsSerializer"/></property>
<property name="deploymentFilter"><inject bean="DeploymentFilter" /></property>
<property name="mainDeployer"><inject bean="MainDeployer"/></property>
<property name="checker"><inject bean="StructureModificationChecker"/></property>
<depends>ProfileServicePersistenceDeployer</depends>
</bean>...

See that line? : file:///path/to/your/deploy/dir ?

Yup, that's the magic line.

Your deploy directory should just contain the WARs or EARs, and they should be named like "yourapp.war" or "yourapps.ear". They can be exploded or not. Heh. "Exploded". I like that. Anyways...

That's it. JBoss5 should now deploy "stuff" from wherever you specified.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Indy Nagpal's Gravatar Thanks for that. It is quite useful.

I've used jmx/twiddle to do something similar, but from command line. With this approach you can put this into a script of some sort if required.

More at my blog: http://nagpals.com/blog/post.cfm/jboss-deploying-w...
# Posted By Indy Nagpal | 6/3/09 2:08 PM
coldshen's Gravatar That's really slick. Thanks for the info!
# Posted By coldshen | 9/22/09 9:20 PM
BlogCFC was created by Raymond Camden. This blog is running version 5.9.3.000. Contact Blog Owner