Different versions of web.xml

16 views
Skip to first unread message

Alex Siman

unread,
Dec 26, 2010, 6:59:16 AM12/26/10
to simple-build-tool
Hi SBT

Is there any approach to have different version of web.xml file? Say
one for development mode, and another for production.

Thanx!

David Copeland

unread,
Dec 26, 2010, 11:37:40 AM12/26/10
to simple-b...@googlegroups.com
Seconded; I had to hack together a shell script to do this (and, granted, didn't look into it a whole lot).  For me, something like the way maven will copy stuff and interpolate property values during packaging would've been sufficient.

Dave

---
My Blog: http://www.naildrivin5.com/blog
Scala Tour for Java Developers: http://www.naildrivin5.com/scalatour
Fork me on Github: http://davetron5000.github.com




--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.


Alex Siman

unread,
Dec 27, 2010, 5:04:27 AM12/27/10
to simple-build-tool
Also it would be more cool to be able to have as many different
versions of any file as I want based on mode (development, production,
etc). Am I missing something and SBT already has such feature?

On Dec 26, 6:37 pm, David Copeland <davetron5...@gmail.com> wrote:
> Seconded; I had to hack together a shell script to do this (and, granted,
> didn't look into it a whole lot).  For me, something like the way maven will
> copy stuff and interpolate property values during packaging would've been
> sufficient.
>
> Dave
>
> ---
> My Blog:http://www.naildrivin5.com/blog
> Scala Tour for Java Developers:http://www.naildrivin5.com/scalatour
> Fork me on Github:http://davetron5000.github.com
>
> On Sun, Dec 26, 2010 at 6:59 AM, Alex Siman <aleksandr.si...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Hi SBT
>
> > Is there any approach to have different version of web.xml file? Say
> > one for development mode, and another for production.
>
> > Thanx!
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "simple-build-tool" group.
> > To post to this group, send email to simple-b...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > simple-build-t...@googlegroups.com<simple-build-tool%2Bunsubscr i...@googlegroups.com>
> > .

David Bernard

unread,
Dec 27, 2010, 5:34:28 AM12/27/10
to simple-b...@googlegroups.com
workaround :
* you can use git branch (I do it for some project)
* you can store variation in separated directories tree that override/complete default one (src/main), and use a system property to define the directory to use (-Dprofile=prod - use -> src/prod)

/davidB

To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.

Alex Siman

unread,
Dec 27, 2010, 9:40:58 AM12/27/10
to simple-build-tool
Hi David,

I don't get, how can I leverage a git branch for this task? Can you
please describe your solution in details?

And as for system property solution... OK, say in development I have
such file:
[src/main/webapp/WEB-INF/web.xml]

but on command "sbt package" I want that in result WAR will be
included another version of web.xml from:
[src/prod/webapp/WEB-INF/web.xml]

What I need to do?
> > > > simple-build-t...@googlegroups.com<simple-build-tool%2Bunsubscr i...@googlegroups.com><simple-build-tool%2Bunsubscr

David Bernard

unread,
Dec 27, 2010, 10:44:49 AM12/27/10
to simple-b...@googlegroups.com


On Mon, Dec 27, 2010 at 15:40, Alex Siman <aleksan...@gmail.com> wrote:
>
> Hi David,
>
> I don't get, how can I leverage a git branch for this task? Can you
> please describe your solution in details?

by example for vscaladoc2_www, I've got a private branch 'prod'.
created by "git checkout -b prod"
when I'm on this branch I commit stuff only for prod (configuration file, web.xml,....)
And before doing deployement on stax.net, I run the following script (from branch master)

  git push origin master
  git checkout prod
  git rebase -i master
  mvn clean install stax:deploy -Pstax
  git checkout master

(I use maven, but the same can be done with sbt)


>
> And as for system property solution... OK, say in development I have
> such file:
> [src/main/webapp/WEB-INF/web.xml]
>
> but on command "sbt package" I want that in result WAR will be
> included another version of web.xml from:
> [src/prod/webapp/WEB-INF/web.xml]
>
> What I need to do?

I'm not an SBT users, but from my limited knowledge, you can try something like

override def extraWebappFiles : PathFinder = System.getProperty("mode") match {
  case null => super.extraWebappFiles
  case mode => descendents(DefaultSourceDirectoryName / mode / webappDirectoryName ##, "*") +++ super.extraWebappFiles
}
I hope this help

/davidB
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.

Alex Siman

unread,
Dec 27, 2010, 11:53:39 AM12/27/10
to simple-build-tool
Thanx a lot, David! I will try your solutions a bit later))

On Dec 27, 5:44 pm, David Bernard <david.bernard...@gmail.com> wrote:
> (seehttp://code.google.com/p/simple-build-tool/wiki/WebApplications)
Reply all
Reply to author
Forward
0 new messages