You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rick <ri...@gmail.com> on 2008/10/07 00:25:09 UTC

Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)

I'm working on a typical JEE application that will be deployed to JBoss.
(JBoss5 if it matters.) Things are going. I have a pretty standard setup:

Parent Module
     EJB-JAR Module
     JAR Module
     WEB Module
     EAR Module


Currently, however, I'm manually having to deal with certain files that I
need in JBoss:
*  datasource.xml files
*  jboss-service.xml
*  log4j.xml files
There will probably be some others as well.

What is the best way to deal with these files? Is the best practice to
create a directory in the parent module or ear module and just create some
custom ant task to move them around where they need to go? I couldn't find
much about a jboss maven plugin to help with these tasks, so I'm assuming
hooking in regular old ant is the way to go?

I'll also want to have certain variables in those files replaced with
variables from a profile (dev, test, prod) depending on what profile I'm
running. I'll look into that as well, since I'm sure there are some docs on
it, but are the any issues to be aware of since I'm guessing these aren't
standard files  that I'm dealing with so is using the replacement mechanism
more difficult?

Thanks

RE: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)

Posted by Martin Gainty <mg...@hotmail.com>.
download andromda source at
http://sourceforge.net/project/showfiles.php?group_id=73047&package_id=117392&release_id=593519
then build the F:\Andromda\samples\animal-quiz\app
this will build a jboss animal-quiz-3.4-SNAPSHOT.ear for you

tweak the pom.xml to suit your needs

HTH
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Mon, 6 Oct 2008 21:00:41 -0400
> From: raiello@acm.org
> Subject: Re: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)
> To: users@maven.apache.org
> 
> I believe that most people use the Ant plugin Assembly to parse the dev, qa, 
> prod
> environment files. I would suggest that you create them all during the 
> build. I have
> seen some people put in the environment during the build and parse the files 
> just for
> that environment. This meant that they had to rebuild for dev, QA and Prod 
> (very
> bad practice!). From a compliance point of view you do want your QA build
> to be the same as the build that you promote into production (obviously you
> have a deployment script to change over the environment files).
> 
> What does everyone else do?
> 
> Bob Aiello
> Editor in Chief
> CM Crossroads
> www.cmcrossroads.com
> http://www.linkedin.com/in/BobAiello
> 
> 
> ----- Original Message ----- 
> From: "Rick" <ri...@gmail.com>
> To: "Maven Users List" <us...@maven.apache.org>
> Sent: Monday, October 06, 2008 6:25 PM
> Subject: Best practice? Where to put app-server specific files (log4j.xml, 
> datsource xml files, jboss-service.xml , etc.)
> 
> 
> > I'm working on a typical JEE application that will be deployed to JBoss.
> > (JBoss5 if it matters.) Things are going. I have a pretty standard setup:
> >
> > Parent Module
> >     EJB-JAR Module
> >     JAR Module
> >     WEB Module
> >     EAR Module
> >
> >
> > Currently, however, I'm manually having to deal with certain files that I
> > need in JBoss:
> > *  datasource.xml files
> > *  jboss-service.xml
> > *  log4j.xml files
> > There will probably be some others as well.
> >
> > What is the best way to deal with these files? Is the best practice to
> > create a directory in the parent module or ear module and just create some
> > custom ant task to move them around where they need to go? I couldn't find
> > much about a jboss maven plugin to help with these tasks, so I'm assuming
> > hooking in regular old ant is the way to go?
> >
> > I'll also want to have certain variables in those files replaced with
> > variables from a profile (dev, test, prod) depending on what profile I'm
> > running. I'll look into that as well, since I'm sure there are some docs 
> > on
> > it, but are the any issues to be aware of since I'm guessing these aren't
> > standard files  that I'm dealing with so is using the replacement 
> > mechanism
> > more difficult?
> >
> > Thanks
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008

Re: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)

Posted by Rick <ri...@gmail.com>.
Thanks everyone. You all make good points. Typically, with our ant builds,
we have a special task called "setup_jboss" that will deploy certain jboss
specific files (after doing some substitutions - ie datsource setup for a
dev db, etc.). It's obviously not run all the time, so I guess I could keep
the seem thing within maven (just haven't used the ant tasks from within
maven yet, but will look into that.


On Mon, Oct 6, 2008 at 10:13 PM, Edelson, Justin <
Justin.Edelson@mtvstaff.com> wrote:

> We treat these JBoss configuration files as artifacts outside of the main
> deployable (read: EAR file). The vast majority of our JBoss sites use the
> same base server configuration, which includes the jboss-service.xml and
> other files. jboss-service.xml uses system property placeholders for
> environmental-specific bits. The system properties are defined in a separate
> file and loaded into JBoss with the -P option. Each instance has its own
> log4j.xml file and datasource xml files, but AFAIK, these could use property
> placeholders as well if necessary. We version control all of these files
> (obviously), but outside of the main application.
>
> The goal of this architecture was, as Bob says below, to use the same build
> between dev, QA, and prod (although in reality, dev is usually a SNAPSHOT
> build from CI) and to simplify new site creation by reusing the same base
> server configuration.
>
> For more application-specific (vs. container-specific) stage-based
> configuration, we use a combination of system properties (-Dstage=qa) and a
> customized version of Spring internals.
>
> Justin Edelson
> VP, Platform Engineering
> MTV Networks Digital
>
> ________________________________
>
> From: Bob Aiello [mailto:raiello@acm.org]
> Sent: Mon 10/6/2008 9:00 PM
> To: Maven Users List
> Subject: Re: Best practice? Where to put app-server specific files
> (log4j.xml, datsource xml files, jboss-service.xml , etc.)
>
>
>
> I believe that most people use the Ant plugin Assembly to parse the dev,
> qa,
> prod
> environment files. I would suggest that you create them all during the
> build. I have
> seen some people put in the environment during the build and parse the
> files
> just for
> that environment. This meant that they had to rebuild for dev, QA and Prod
> (very
> bad practice!). From a compliance point of view you do want your QA build
> to be the same as the build that you promote into production (obviously you
> have a deployment script to change over the environment files).
>
> What does everyone else do?
>
> Bob Aiello
> Editor in Chief
> CM Crossroads
> www.cmcrossroads.com
> http://www.linkedin.com/in/BobAiello
>
>
> ----- Original Message -----
> From: "Rick" <ri...@gmail.com>
> To: "Maven Users List" <us...@maven.apache.org>
> Sent: Monday, October 06, 2008 6:25 PM
> Subject: Best practice? Where to put app-server specific files (log4j.xml,
> datsource xml files, jboss-service.xml , etc.)
>
>
> > I'm working on a typical JEE application that will be deployed to JBoss.
> > (JBoss5 if it matters.) Things are going. I have a pretty standard setup:
> >
> > Parent Module
> >     EJB-JAR Module
> >     JAR Module
> >     WEB Module
> >     EAR Module
> >
> >
> > Currently, however, I'm manually having to deal with certain files that I
> > need in JBoss:
> > *  datasource.xml files
> > *  jboss-service.xml
> > *  log4j.xml files
> > There will probably be some others as well.
> >
> > What is the best way to deal with these files? Is the best practice to
> > create a directory in the parent module or ear module and just create
> some
> > custom ant task to move them around where they need to go? I couldn't
> find
> > much about a jboss maven plugin to help with these tasks, so I'm assuming
> > hooking in regular old ant is the way to go?
> >
> > I'll also want to have certain variables in those files replaced with
> > variables from a profile (dev, test, prod) depending on what profile I'm
> > running. I'll look into that as well, since I'm sure there are some docs
> > on
> > it, but are the any issues to be aware of since I'm guessing these aren't
> > standard files  that I'm dealing with so is using the replacement
> > mechanism
> > more difficult?
> >
> > Thanks
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>


-- 
Rick

RE: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)

Posted by "Edelson, Justin" <Ju...@mtvstaff.com>.
We treat these JBoss configuration files as artifacts outside of the main deployable (read: EAR file). The vast majority of our JBoss sites use the same base server configuration, which includes the jboss-service.xml and other files. jboss-service.xml uses system property placeholders for environmental-specific bits. The system properties are defined in a separate file and loaded into JBoss with the -P option. Each instance has its own log4j.xml file and datasource xml files, but AFAIK, these could use property placeholders as well if necessary. We version control all of these files (obviously), but outside of the main application.
 
The goal of this architecture was, as Bob says below, to use the same build between dev, QA, and prod (although in reality, dev is usually a SNAPSHOT build from CI) and to simplify new site creation by reusing the same base server configuration. 
 
For more application-specific (vs. container-specific) stage-based configuration, we use a combination of system properties (-Dstage=qa) and a customized version of Spring internals.
 
Justin Edelson
VP, Platform Engineering
MTV Networks Digital

________________________________

From: Bob Aiello [mailto:raiello@acm.org]
Sent: Mon 10/6/2008 9:00 PM
To: Maven Users List
Subject: Re: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)



I believe that most people use the Ant plugin Assembly to parse the dev, qa,
prod
environment files. I would suggest that you create them all during the
build. I have
seen some people put in the environment during the build and parse the files
just for
that environment. This meant that they had to rebuild for dev, QA and Prod
(very
bad practice!). From a compliance point of view you do want your QA build
to be the same as the build that you promote into production (obviously you
have a deployment script to change over the environment files).

What does everyone else do?

Bob Aiello
Editor in Chief
CM Crossroads
www.cmcrossroads.com
http://www.linkedin.com/in/BobAiello


----- Original Message -----
From: "Rick" <ri...@gmail.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Monday, October 06, 2008 6:25 PM
Subject: Best practice? Where to put app-server specific files (log4j.xml,
datsource xml files, jboss-service.xml , etc.)


> I'm working on a typical JEE application that will be deployed to JBoss.
> (JBoss5 if it matters.) Things are going. I have a pretty standard setup:
>
> Parent Module
>     EJB-JAR Module
>     JAR Module
>     WEB Module
>     EAR Module
>
>
> Currently, however, I'm manually having to deal with certain files that I
> need in JBoss:
> *  datasource.xml files
> *  jboss-service.xml
> *  log4j.xml files
> There will probably be some others as well.
>
> What is the best way to deal with these files? Is the best practice to
> create a directory in the parent module or ear module and just create some
> custom ant task to move them around where they need to go? I couldn't find
> much about a jboss maven plugin to help with these tasks, so I'm assuming
> hooking in regular old ant is the way to go?
>
> I'll also want to have certain variables in those files replaced with
> variables from a profile (dev, test, prod) depending on what profile I'm
> running. I'll look into that as well, since I'm sure there are some docs
> on
> it, but are the any issues to be aware of since I'm guessing these aren't
> standard files  that I'm dealing with so is using the replacement
> mechanism
> more difficult?
>
> Thanks
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org




Re: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)

Posted by Bob Aiello <ra...@acm.org>.
I believe that most people use the Ant plugin Assembly to parse the dev, qa, 
prod
environment files. I would suggest that you create them all during the 
build. I have
seen some people put in the environment during the build and parse the files 
just for
that environment. This meant that they had to rebuild for dev, QA and Prod 
(very
bad practice!). From a compliance point of view you do want your QA build
to be the same as the build that you promote into production (obviously you
have a deployment script to change over the environment files).

What does everyone else do?

Bob Aiello
Editor in Chief
CM Crossroads
www.cmcrossroads.com
http://www.linkedin.com/in/BobAiello


----- Original Message ----- 
From: "Rick" <ri...@gmail.com>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Monday, October 06, 2008 6:25 PM
Subject: Best practice? Where to put app-server specific files (log4j.xml, 
datsource xml files, jboss-service.xml , etc.)


> I'm working on a typical JEE application that will be deployed to JBoss.
> (JBoss5 if it matters.) Things are going. I have a pretty standard setup:
>
> Parent Module
>     EJB-JAR Module
>     JAR Module
>     WEB Module
>     EAR Module
>
>
> Currently, however, I'm manually having to deal with certain files that I
> need in JBoss:
> *  datasource.xml files
> *  jboss-service.xml
> *  log4j.xml files
> There will probably be some others as well.
>
> What is the best way to deal with these files? Is the best practice to
> create a directory in the parent module or ear module and just create some
> custom ant task to move them around where they need to go? I couldn't find
> much about a jboss maven plugin to help with these tasks, so I'm assuming
> hooking in regular old ant is the way to go?
>
> I'll also want to have certain variables in those files replaced with
> variables from a profile (dev, test, prod) depending on what profile I'm
> running. I'll look into that as well, since I'm sure there are some docs 
> on
> it, but are the any issues to be aware of since I'm guessing these aren't
> standard files  that I'm dealing with so is using the replacement 
> mechanism
> more difficult?
>
> Thanks
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Best practice? Where to put app-server specific files (log4j.xml, datsource xml files, jboss-service.xml , etc.)

Posted by Brett Porter <br...@gmail.com>.
To my knowledge, these are usually used as standard resource files,
bundled up in the same way as anything else going in the archive. I'm
not sure if the JBoss plugin will help you manipulate the files, but
if you are hand editing them you should have no trouble.

As far as filtering them goes, this is a very common question. I
highly recommend not deploying artifacts to the repository that are
dependent on a particular environment.

Cheers,
Brett

2008/10/7 Rick <ri...@gmail.com>:
> I'm working on a typical JEE application that will be deployed to JBoss.
> (JBoss5 if it matters.) Things are going. I have a pretty standard setup:
>
> Parent Module
>     EJB-JAR Module
>     JAR Module
>     WEB Module
>     EAR Module
>
>
> Currently, however, I'm manually having to deal with certain files that I
> need in JBoss:
> *  datasource.xml files
> *  jboss-service.xml
> *  log4j.xml files
> There will probably be some others as well.
>
> What is the best way to deal with these files? Is the best practice to
> create a directory in the parent module or ear module and just create some
> custom ant task to move them around where they need to go? I couldn't find
> much about a jboss maven plugin to help with these tasks, so I'm assuming
> hooking in regular old ant is the way to go?
>
> I'll also want to have certain variables in those files replaced with
> variables from a profile (dev, test, prod) depending on what profile I'm
> running. I'll look into that as well, since I'm sure there are some docs on
> it, but are the any issues to be aware of since I'm guessing these aren't
> standard files  that I'm dealing with so is using the replacement mechanism
> more difficult?
>
> Thanks
>



-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org