You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm-users@maven.apache.org by Steven Crosley <st...@mac.com> on 2007/08/08 00:51:31 UTC

Maven SVN Integration

I'm pretty new to Maven, but I've created some sample multi-project  
applications successfully in the last couple of weeks.  I'm a bit  
stuck as to how SVN integration works.  This is kind of a 2-part  
question.

1.) I've added the dependency in my top-level pom.xml like so:

	<dependency>
	    <groupId>org.apache.maven.scm</groupId>
	    <artifactId>maven-scm-provider-svn</artifactId>
	    <version>1.0-alpha-4</version>
	</dependency>

And I've added the scm element in the same pom.xml as well:

    <scm>
      <connection>scm:svn:http://localhost:8080/svn/private/ 
sampleproject</connection>
      <developerConnection>scm:svn:https://localhost:8080/svn/private/ 
sampleproject</developerConnection>
      <url>http://localhost:8080/svn/private/sampleproject</url>
   </scm>

When I run it like this:

mvn scm:checkin -Dmessage="This is a test"

I get a successful build, but the svn executes a file command instead  
of sending it to my repository:

[INFO] [scm:checkin]
[INFO] Executing: svn --non-interactive commit --file /tmp/maven- 
scm-947054377.commit
[INFO] Working directory: /Users/myuser/Documents/Projects/sampleproject

2.) Ideally what I'd like to do is configure Maven to have multiple  
profiles based in releases, so that when i release a test build, it  
commits my changes to the correct SVN repository branch  
automatically. Would I have to build a plugin to do this? Or is it  
already possible?  Any examples?

Re: Maven SVN Integration

Posted by Steven Crosley <st...@mac.com>.
Thanks, Emmanuel.

I had to use `svn add *` before it actually checked in the items,  
which makes sense.

I guess what I'd really like to know is if this can be automated to  
perform SVN tasks any time I run a specific goal, such as install.

So running mvn install -Dmessage="This is a test"

Performs these actions:

automatically adds new files
automatically removes files that no longer exist
automatically commits changes to the SVN repository

Thanks again for your help,
Steven


On Aug 8, 2007, at 10:39 AM, Emmanuel Venisse wrote:

>
>
> Steven Crosley a écrit :
>> I'm pretty new to Maven, but I've created some sample multi- 
>> project applications successfully in the last couple of weeks.   
>> I'm a bit stuck as to how SVN integration works.  This is kind of  
>> a 2-part question.
>> 1.) I've added the dependency in my top-level pom.xml like so:
>> <dependency>
>>    <groupId>org.apache.maven.scm</groupId>
>>    <artifactId>maven-scm-provider-svn</artifactId>
>>    <version>1.0-alpha-4</version>
>> </dependency>
>
> You don't need to add this dependency if your code doesn't depends  
> on it, the maven scm plugin already have it in its dependencies.
>
>> And I've added the scm element in the same pom.xml as well:
>>    <scm>
>>      <connection>scm:svn:http://localhost:8080/svn/private/ 
>> sampleproject</connection>
>>      <developerConnection>scm:svn:https://localhost:8080/svn/ 
>> private/sampleproject</developerConnection>
>>      <url>http://localhost:8080/svn/private/sampleproject</url>
>>   </scm>
>> When I run it like this:
>> mvn scm:checkin -Dmessage="This is a test"
>> I get a successful build, but the svn executes a file command  
>> instead of sending it to my repository:
>> [INFO] [scm:checkin]
>> [INFO] Executing: svn --non-interactive commit --file /tmp/maven- 
>> scm-947054377.commit
>> [INFO] Working directory: /Users/myuser/Documents/Projects/ 
>> sampleproject
>
> The "--file" parameter is used to send to commit message, in your  
> case, /tmp/maven-scm-947054377.commit contains "This is a test"
> Files committed are files in sub-directories of the working  
> directory. The working directory must be a valid working copy of a  
> specific trunk/branch/tag
>
>> 2.) Ideally what I'd like to do is configure Maven to have  
>> multiple profiles based in releases, so that when i release a test  
>> build, it commits my changes to the correct SVN repository branch  
>> automatically. Would I have to build a plugin to do this? Or is it  
>> already possible?  Any examples?
>
> A working copy is a checkout of a unique branch, you can't commit a  
> change to an other branch. If you want to work on an other branch,  
> it's better to checkout the branch in an other directory or to  
> switch the actual working copy to the new branch
>
> Emmanuel
>


Re: Maven SVN Integration

Posted by Emmanuel Venisse <em...@venisse.net>.

Steven Crosley a écrit :
> I'm pretty new to Maven, but I've created some sample multi-project 
> applications successfully in the last couple of weeks.  I'm a bit stuck 
> as to how SVN integration works.  This is kind of a 2-part question.
> 
> 1.) I've added the dependency in my top-level pom.xml like so:
> 
> <dependency>
>    <groupId>org.apache.maven.scm</groupId>
>    <artifactId>maven-scm-provider-svn</artifactId>
>    <version>1.0-alpha-4</version>
> </dependency>

You don't need to add this dependency if your code doesn't depends on it, the maven scm plugin already have it in its dependencies.

> 
> And I've added the scm element in the same pom.xml as well:
> 
>    <scm>
>      
> <connection>scm:svn:http://localhost:8080/svn/private/sampleproject</connection>
>      
> <developerConnection>scm:svn:https://localhost:8080/svn/private/sampleproject</developerConnection>
>      <url>http://localhost:8080/svn/private/sampleproject</url>
>   </scm>
> 
> When I run it like this:
> 
> mvn scm:checkin -Dmessage="This is a test"
> 
> I get a successful build, but the svn executes a file command instead of 
> sending it to my repository:
> 
> [INFO] [scm:checkin]
> [INFO] Executing: svn --non-interactive commit --file 
> /tmp/maven-scm-947054377.commit
> [INFO] Working directory: /Users/myuser/Documents/Projects/sampleproject

The "--file" parameter is used to send to commit message, in your case, /tmp/maven-scm-947054377.commit contains "This is a test"
Files committed are files in sub-directories of the working directory. The working directory must be a valid working copy of a specific trunk/branch/tag

> 
> 2.) Ideally what I'd like to do is configure Maven to have multiple 
> profiles based in releases, so that when i release a test build, it 
> commits my changes to the correct SVN repository branch automatically. 
> Would I have to build a plugin to do this? Or is it already possible? 
>  Any examples?

A working copy is a checkout of a unique branch, you can't commit a change to an other branch. If you want to work on an other branch, it's better to checkout the branch in an other directory or to 
switch the actual working copy to the new branch

Emmanuel