NobleUplift
NobleUplift

Reputation: 6015

What should the directory structure of Maven + version control look like?

For instance, how do I manage trunks and branches with Maven and Git? Or Maven and SVN? Would it be:

trunk/src/main/java
trunk/src/main/resources
trunk/src/test/java
trunk/src/test/resources
branches/branch1/src/main/java
branches/branch1/src/main/resources
branches/branch1/src/test/java
branches/branch1/src/test/resources

Or what else?

Upvotes: 0

Views: 352

Answers (1)

drvdijk
drvdijk

Reputation: 5554

Maven

For Maven, the "Standard Directory Layout" is described in the Maven Introduction. That's your Maven project. To check that into source control, you'd commit that complete directory structure to where your repository lives.

SVN

In Subversion the URL identifies the location of the repository and the path inside the repository, so you organize the layout of the repository and its meaning. Normally you would have trunk/, branches/ and tags/ directories. (source: Git - SVN Crash Course)

So then you indeed checkout trunk and have the src/... structure there, if you're working on the trunk. Switching to another branch would just switch your local workspace over to the branches/branch directory of the svn repository. Note the subtlety here: you're switching a different part of the remote SVN repository. You'd normally not have the whole root checked out on your hard drive, just the trunk or branches/branch1 part of it.

Git

In Git the URL is just the location of the repository, and it always contains branches and tags. One of the branches is the default (normally named master). (source: Git - SVN Crash Course)

So with Git on the other hand, you do have the whole repository checked out on your hard drive. However, git does not store branches in a different folder relative to the root of the repository, it uses a tagging system for branches.

Upvotes: 1

Related Questions