views:

368

answers:

4

Hi

How should I handle WAR files (using GWT) along with Subversion in Eclipse?

The problem atm. is when adding the war folder to SVN, it includes all the compiled code, which I don't have a option to filter out, making svn checkouts long and pointless.

I don't want my compiled class files on my subversion server, and I don't want svn information in the war package either. But I still need the client-content (html, javascript, css) to be included with the subversion.

So what's the Java EE way of handling this?

+1  A: 

Do you know about the svn:ignore property you can set for every folder? Take a look at the very good book "Version Control with Subversion".

Edit If eclipse doesn't show you the folder structure of your procject as it really is, I'd recommend to switch to the shell and use the svn commandline utility.

Edit 2: svn:ignore support patterns for filenames. So you don't have to explicitly ignore every file you are not interested in.

It's related to the very specific concept of WAR files in Java EE. If you're unfamiliar with WAR files, and how they work, you will not be able to give any useful information for this question.
Claus Jørgensen
+1  A: 

You can add the war (and any file you don't want to be in SVN) to svn:ignore.

In Eclipse you can do:

  1. right click the file(s) you don't want in SVN
  2. Team -> add to svn:ignore

You can also use wildcard.

Eclipse doesn't support it directly, but you can do in the root of your project:

  1. Team -> set property
  2. add svn:ignore as property and *.class or whatever you want in text property
nanda
I'm perfectly aware of that, but as you should know, the class files aren't visible in the project management in Eclipse. And I obviously don't want to filter out the entire WAR folder, since that would force me to EXPLICIT select EVERY SINGLE FILE manually. Which would be bloody stupid.
Claus Jørgensen
You can use wildcard. Eclipse doesn't support it directly, but you can do in the root of your project: 1. Team -> set property 2. add *.class or whatever you wantIs that what you want?
nanda
It just seems strange that Eclipse would need such hackish and stupid solutions. It's already annoying me a lot that it's trying to commit files not part of the visual project in the IDE.
Claus Jørgensen
Then maybe it won't sound so stupid if you realize that Subclipse is not a project of Eclipse.
nanda
And yet it's still Eclipse's fault, since their project management display is utterly fail. And the "plugin isn't part of the core" excuse isn't valid. It's still a problem with Eclipse.
Claus Jørgensen
So use the command line, will you?
A: 

Why would you want a .war file in your Subversion without the compiled sources? The point of the .war (web archive) is that it can be deployed to a server.

If you decide to archive your Java packages (.jar, .war, .ear) with subversion, do so in the complete and final version you would also use for your applications on production/test servers. The whole point of archiving these would be to save a package version that can be used/deployed/... as is, without further tampering.

I would advice you to save only the major versions/releases/branches of your Java packages on subversion. The minor releases can easily be built ad hoc, so there would be no point in archiving them. And when you have your whole project subversion-ized it is also no problem to manage client content like html, css, ... .

fgysin
Yes, but what's the idea of having SOURCE revision include binaries? The obvious problem with having the binaries along, is that every single commit would take ages due to all the updated class files that's been compiled would have to be committed as well. It's just forcing extraordinary time on version control, time that shouldn't be needed.
Claus Jørgensen
Yes. That's why I suggested to archive only major releases/branches in full deployable versions.That means that you would only have to do such an 'expensive' svn update every once in a while on a release/branch to save the current .war file as a whole.My advice would be create two folders within your subversion-ized project: One is excluded from version control (see the other responses for links and syntax of how to achieve that) the other one - the one for major releases and branches - is 'version controlled'.
fgysin
@fgysin: AFAIK, you and Claus refered to different war. Claus meant war folder and you meant war file. war folder in GWT contains source (text file). war file on the other hand is binary file.Sorry if I'm wrong
nanda
+1  A: 

Other places have pointed out the ideal solution is trying another project structure, or writing a custom ANT build.

Claus Jørgensen