Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a Git repository as an exploded war?

I am in the following situation...

I am used to being able to check out a Subversion server subproject into JBoss as an exploded war: in my case, I call a directory Blah.war, put it in C:\jboss-6.1.0.Final\server\default\deploy\Blah.war, and JBoss picks it right up.

I'm having trouble doing this with Git. The SVN repository I'm pulling from is laid out as follows:

.../Project/trunk/Services
.../Project/trunk/Web

If I check the entire project into the deploy/ folder, there won't be a .war directory at the top. Obviously, I can't check out make trunk/ into my deploy/ directory. I've thought of using some kind of symbolic link, but can't see this working in Windows.

Does anyone have any idea how to do this? I've been hearing good things about DVCS, but Git is useless to me if I can't handle the server development use case.

like image 818
orbfish Avatar asked Dec 16 '13 18:12

orbfish


1 Answers

That is a good illustration of the difference of granularity between SVN repo and git repo:

  • You can put everything in an SVN repo and only checkout the part you are interested in.
  • You are supposed to checkout all of a git repo

So ideally Services and web would be two repos.


Note that having one checked out git repo outside jboss, and a symbolic link can work, even on Windows, which does support symlink (with mklink).


Finally, if you don't want several repos or symlink, you can do a sparse checkout, with git read-tree, as describe in this blog post "Using Git Sparse Checkout", by Brian Coyner (briancoyner).

cd C:\jboss-6.1.0.Final\server\default\deploy\
git init Blah.war
cd Blah.war
git config core.sparsecheckout true
echo Web >> .git/info/sparse-checkout
git remote add -f origin /url/to/your/repo.git
git pull origin master
like image 179
VonC Avatar answered Nov 05 '22 11:11

VonC