aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven & Subversion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven & Subversion" Watch "Maven & Subversion" New topic
Author

Maven & Subversion

Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
Hi guys,

Just a general question really...

I have been looking as using Maven2 for project control (folder structure, docs, maven webpage etc) one of the things I wanted to do is set Maven up to download latest trunk from SVN.

I hjave had a look around and like most stuff to do with Mave, the help is minimal!

I have been trying the following cmd line

C:\>mvn scm:update -Dbasedir=C:\test_svn -Dmaven.scm.method=svn:http://localhost.com/testproj/trunk/ -Dmaven.scm.update.
dir=maven-cruisecontrol-plugin -DconnectionType=developerConnection

but get the following error:

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'scm'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [scm:update] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: update. It requires a project with an existing pom.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Nov 08 16:03:05 GMT 2007
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------------------------------------------

Any basic help appreciated, working example would be great! :-D
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

A .pom has to exist in the directory you're executing mvn in - it looks like you're trying to pull down a new project this way - unfortunately, this isn't how the SCM plugin works You have to pull the project down from version control "manually" the first time, or you have to set up a "bootstrap POM" for the first time. Afterwards the POM exists, so you can update from it.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Kevin P Smith
Ranch Hand

Joined: Feb 18, 2005
Posts: 362
cheers for that, I opted for downloading svn to my local machine in the end and running the svn checkout command, this works apart from one issue...

It wont pull down a svn into existing folders.

See I am using Maven to create a folder structure (which would be used as a template for any new projects)
Then using svn to pull down the subversion repositry for it. (this would obviously only be an issue for someone joining an exising project)

problem is, Maven will crate the project sructure, then when you run SVN you get the following:

C:\maven\test\work>svn checkout svn checkout http://localhost.com/test/trunk/source/

http://lssvn.fcg.com/pluto2/trunk/source
svn: Failed to add directory 'source\build': object of the same name already exists

Is there a force command for svn or 'add' I only want to put the content of source/build into my local source/build folder.
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You shouldn't use Maven to create the structure and then pull contents from svn - one person should create a brand-new project in maven, check it into subversion, and then he and everyone else will just use the checked in POM from then on.

If you're attempting to upgrade an existing non-Maven project in a svn repository to Maven, the best option is to create the Maven project in a separate folder, then manually create or copy over the folders and files created by the Maven project into the working directory of the svn project - check in all changes and since the folder structure is the same, the POM won't care.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Maven & Subversion