Reputation: 720
We have a bunch of smaller projects in a single SVN repository. The repository has the following structure:
/trunk
/artifactId1
/artifactId2
/groupId
/artifactId3
/artifactId4
/branches
... see above
/tags
So it looks a bit like a maven repository.
Now I want the maven release plugin to create a similar structure when tagging. I changed the plugin configuration to:
<tagNameFormat>@{project.groupId}/@{project.artifactId}/@{project.version}</tagNameFormat>
The maven release plugin will create the correct SVN url: https://repo/tags/groupId/artifactId3/1.0.0
However the path structure does not exist yet in the repository, so the SVN "tag" action fails.
I don't want to create the path structure every time when a new artifact is added to the SVN repo that needs tag support. Is there a way to configure maven to create the parent structure first before tagging? Or do I need to create a plugin for maven that does this?
Upvotes: 0
Views: 837
Reputation: 7924
As you're finding nested tags and branches are not the path - no tooling is going to play well with them out of the box.
It sounds like ArtifactID1-4 are separate svn projects, which are not built and released together. Perhaps they should each be a project in svn with their own branches tags and trunk folders. You'd avoid the mess you mentioned as well as the mess of nested branches & tags.
Upvotes: 1
Reputation: 5677
I was already facing this kind of issue, but I won't give you a straight answer to solve your problems. Indeed, you try to do something what is not in the "maven way"...
For what I understand, you try to tag :
Tagging one artifact
In the case of tagging artifact3 only, you're right. The first time you try to tag, you are unable to do it because the full structure can't be created in one commande (svn tag is indeed a copy, and copy command doesn't support option allowing copy AND create directory, like "mkdir -p" on linux.
But however Maven conventions (default behaviour) is tags/artifactId-version, you can create your own structure and your own template previously to perform release (via your IDE or in svn command line). Then, change tagNameFormat as you wish (and as you seems to do) :
<project>
[...]
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<tagNameFormat>${groupId}/${artifactId}/@{project.version}</tagNameFormat>
</configuration>
</plugin>
[...]
</plugins>
[...]
</build>
[...]
</project>
You could also modify tagBase, as khmarbaise said, with a mix of tagBase and tagFormat (to override default behaviour). I had never try it, but it should work. Please, note that version use @ and not $ (it must not be replaced during commit or before, but used later during taggin operation).
Obviously, you will have to create a suitable structure for each artifacts you want to tag in this way. But you will only have to do it one time.
Tagging all artifacts
If you want to tag all artifacts in one time, this will be much more difficult. I'm not sure this is what you want, so i'll be brief, giving only some clues :
If I'm mistaken on your intentions, don't hesitate to reply me, giving more information.
Good luck :)
Upvotes: 0
Reputation: 97399
The problem with that is simply cause the tags folder does not contain the groupId and artifactid folder. You need to set the tagBase with the configuration of your release plugin. This can be done in a pluginManagement section in your super-pom.
Upvotes: 0