[
https://jira.codehaus.org/browse/SCM-612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=277803#comment-277803
]
Andreas Ebbert-Karroum commented on SCM-612:
--------------------------------------------
Hi,
I haven't tried it, but I doubt that this change is fixing everything that I
described on the mailing list.
{quote}
h2. Step 1
So, I started with a very simple multi-module project (/pom.xml and
/multi/pom.xml) and tried to release just a single module (multi). It turned
out that this is not possible, because during the release:perform phase, the
whole hg repository is checked out, and the build is started in the root of
that repository.
=> Use the latest maven-release-plugin:2.2-SNAPSHOT in which
MRELEASE-457<http://jira.codehaus.org/browse/MRELEASE-457>is fixed.
h2. Step 2
The new dependencies with the snapshot release plugin also updates to a
newer hg scm provider. The new hg scm provider has the interesting new habit
to throw an exception, when you want to tag something, which does not
concern the whole repository.
Caused by: org.apache.maven.scm.ScmException: This provider doesn't support
tagging subsets of a directory
at
org.apache.maven.scm.provider.hg.command.tag.HgTagCommand.executeTagCommand(HgTagCommand.java:77)
at
org.apache.maven.scm.command.tag.AbstractTagCommand.executeCommand(AbstractTagCommand.java:81)
at
org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
... 29 more
=> Update the dependencies of maven-release-plugin:2.2-SNAPSHOT to use
maven-scm-provider-hg:1.4
h2. Step 3
The next step was to move the parent pom out of the root of the hg
repository. We have a standardized layout in our hg repositories (to take
into account various tradeoffs between maven, m2eclipse, hudson, etc.) that
we have all projects in directories under the root directory. So I tried to
have
/ root / pom.xml (having a module ../multi)
and
/ multi / pom.xml (having a parent ../root)
The release plugin did not like that at all:
[INFO] EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin]
prepare release root-1.6" C:\Temp\releasetest\parent\pom.xml
C:\Temp\releasetest\multi\pom.xml"
[INFO] EXECUTING: cmd.exe /X /C "*hg push file:///C:/Temp/releasetestrepo*"
[INFO] Tagging release with the label root-1.6...
[INFO] EXECUTING: cmd.exe /X /C "hg tag --message "[maven-release-plugin]
copy for tag root-1.6" root-1.6"
[INFO] EXECUTING: cmd.exe /X /C "*hg push file:///C:/Temp*"
[ERROR]
EXECUTION FAILED
Execution of cmd : push failed with exit code: -1.
Working directory was:
c:\temp\releasetest
Your Hg installation seems to be valid and complete.
Hg version: 1.6.2 (OK)
This is probably a bug, but I have no idea if this is in the scm provider,
release plugin, shared components, ... I'm glad to create a jira issue for
it, but would like to do so for the right project.
=> Having no pom.xml in the root of the repository is apparently a bad idea.
But we need to have our "parent" in a folder under the root directly. So I
created a thin dummy pom, which just has the real parent as module.
h2. Step 4
So we now have:
/ pom.xml
/ parent / pom.xml
/ multi / pom.xml
While I created the root pom.xml, I tried to optimize a bit and included
localCheckout=true to the plugin configuration, so that the tag checkout
does not happen from the remote repository, but from the local one. Bad
idea:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.2-SNAPSHOT:perform
(default-cli) on project root: The scm url is invalid.
[ERROR] - An hg 'file' url must be on the form 'file:///' or
'file://localhost/'.
My scm url is: scm:hg:file:///C:/Temp/releasetestrepo
So also the "remote" hg repository is on the local filesystem, but when the
local checkout occurs, the url is apparently not constructed correctly.
=> Ok, no localCheckout. Not a big deal, moving on.
h2. Step 5
If possible, I don't want the /parent/pom.xml to inherit from /pom.xml,
because it may well be, that it needs to inherit from something completely
different. I only wanted to use the /pom.xml as a forwarder to
/parent/pom.xml. So I tried that, and tried to release the "multi"-module. I
did this by running from working directory /parent the command "mvn
--batch-mode -pl multi release:prepare". But I could not find a working scm
configuration in /parent/pom.xml
When it was set to "scm:hg:file:///C:/Temp/releasetestrepo/parent" I got
this error - apperently it tried to replace the current module name "parent"
in the scm url with "multi":
[INFO] EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin]
prepare release multi-1.22" C:\Temp\releasetest\multi\pom.xml"
[INFO] EXECUTING: cmd.exe /X /C "hg push *
file:///C:/Temp/releasetestrepo/multi*"
But when I set the scm url to the correct value
"scm:hg:file:///C:/Temp/releasetestrepo" it removed the last path element:
[INFO] EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin]
prepare release multi-1.22" C:\Temp\releasetest\multi\pom.xml"
[INFO] EXECUTING: cmd.exe /X /C "hg push *file:///C:/Temp/multi*"
==> so apparently the /parent/pom.xml needs to inherit from /pom.xml and scm
info should be in the root.
h2. Step 6
So I tried that but ran into problems again!
C:\Temp\releasetest>mvn -pl multi --offline --batch-mode release:prepare
[INFO] Checking in modified POMs...
[INFO] EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin]
prepare release multi-1.28" C:\Temp\releasetest\multi\pom.xml"
[INFO] EXECUTING: cmd.exe /X /C "hg push file:///C:/Temp/multi"
[ERROR]
EXECUTION FAILED
Execution of cmd : push failed with exit code: -1.
Working directory was:
C:\Temp\releasetest\multi
Your Hg installation seems to be valid and complete.
Hg version: 1.6.2 (OK)
=> This means, the scm configuration has to be present in every module, even
if it is absolutely the same everywhere.
h2. Step 7
So I got it working in an example project, but the fact, that I have to copy
the scm configuration into every module, makes that solution impossible to
rollout to any serious production environment.
{quote}
{code:title=pom.xml}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.aek.test</groupId>
<artifactId>root</artifactId>
<version>1.12-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>parent</module>
</modules>
<scm>
<connection>scm:hg:file:///C:/Temp/releasetestrepo</connection>
<developerConnection>scm:hg:file:///C:/Temp/releasetestrepo</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2-SNAPSHOT</version>
<configuration>
<allowTimestampedSnapshots>true</allowTimestampedSnapshots>
<goals>install</goals>
<resume>false</resume>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-hg</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>https://repository.apache.org/content/groups/snapshots/
</url>
</pluginRepository>
</pluginRepositories>
</project>
{code}
{code:title=/parent/pom.xml}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.aek.test</groupId>
<artifactId>root</artifactId>
<version>1.10</version>
<relativePath>..</relativePath>
</parent>
<groupId>de.aek.test</groupId>
<artifactId>parent</artifactId>
<version>1.13-SNAPSHOT</version>
<packaging>pom</packaging>
<scm>
<connection>scm:hg:file:///C:/Temp/releasetestrepo</connection>
<developerConnection>scm:hg:file:///C:/Temp/releasetestrepo</developerConnection>
</scm>
<modules>
<module>../multi</module>
</modules>
</project>
{code}
{code:title=/multi/pom.xml}
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.aek.test</groupId>
<artifactId>parent</artifactId>
<version>1.12</version>
<relativePath>../parent</relativePath>
</parent>
<groupId>de.aek.test</groupId>
<artifactId>multi</artifactId>
<version>1.27-SNAPSHOT</version>
<packaging>pom</packaging>
<scm>
<connection>scm:hg:file:///C:/Temp/releasetestrepo</connection>
<developerConnection>scm:hg:file:///C:/Temp/releasetestrepo</developerConnection>
</scm>
</project>
{code}
{code:title=preparing and performing a release}
C:\Temp\releasetest>mvn -pl multi --offline --batch-mode release:prepare
[INFO] Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building multi 1.27-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.2-SNAPSHOT:prepare (default-cli) @ multi
---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: pom.xml.next, release.properties,
pom.xml.releaseBackup, pom.xml.backup, pom.xml.branch, pom.xml.tag
[INFO] EXECUTING: cmd.exe /X /C "hg status"
[INFO] Not a file: C:\Temp\releasetest\multi\multi\release.properties.
Ignoring
[INFO] Ignoring SNAPSHOT depenedencies and plugins ...
[INFO] Transforming 'multi'...
[INFO] Not generating release POMs
[INFO] Executing goals 'clean verify'...
[INFO] [INFO] Scanning for projects...
[INFO] [INFO]
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO] Building multi 1.27
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO]
[INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ multi ---
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO] Total time: 1.063s
[INFO] [INFO] Finished at: Thu Mar 03 15:52:50 CET 2011
[INFO] [INFO] Final Memory: 2M/5M
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] Checking in modified POMs...
[INFO] EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin]
prepare release multi-1.27" C:\Temp\releasetest\multi\pom.xml"
[INFO] EXECUTING: cmd.exe /X /C "hg push file:///C:/Temp/releasetestrepo"
[INFO] Tagging release with the label multi-1.27...
[INFO] EXECUTING: cmd.exe /X /C "hg tag --message "[maven-release-plugin]
copy for tag multi-1.27" multi-1.27"
[INFO] EXECUTING: cmd.exe /X /C "hg push file:///C:/Temp/releasetestrepo"
[INFO] EXECUTING: cmd.exe /X /C "hg locate"
[INFO] Transforming 'multi'...
[INFO] Not removing release POMs
[INFO] Checking in modified POMs...
[INFO] EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin]
prepare for next development iteration" C:\Temp\releasetest\multi\pom.xml"
[INFO] EXECUTING: cmd.exe /X /C "hg push file:///C:/Temp/releasetestrepo"
[INFO] Release preparation complete.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 7.625s
[INFO] Finished at: Thu Mar 03 15:52:52 CET 2011
[INFO] Final Memory: 3M/7M
[INFO]
------------------------------------------------------------------------
C:\Temp\releasetest>mvn -pl multi --offline --batch-mode release:perform
[INFO] Scanning for projects...
[INFO]
[INFO]
------------------------------------------------------------------------
[INFO] Building multi 1.28-SNAPSHOT
[INFO]
------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.2-SNAPSHOT:perform (default-cli) @ multi
---
[INFO] Checking out the project to perform the release ...
[INFO] Removing C:\Temp\releasetest\multi\target\checkout
[INFO] EXECUTING: cmd.exe /X /C "hg clone -r multi-1.27
file:///C:/Temp/releasetestrepo C:\Temp\releasetest\multi\target\checkout"
[INFO] EXECUTING: cmd.exe /X /C "hg locate"
[INFO] Invoking perform goals in directory
C:\Temp\releasetest\multi\target\checkout\multi
[INFO] Executing goals 'install'...
[INFO] [INFO] Scanning for projects...
[INFO] [WARNING]
[INFO] [WARNING] Some problems were encountered while building the effective
model for de.aek.test:multi:pom:1.27
[INFO] [WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-javadoc-plugin is missing.
[INFO] [WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-deploy-plugin is missing.
[INFO] [WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-source-plugin is missing.
[INFO] [WARNING]
[INFO] [WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[INFO] [WARNING]
[INFO] [WARNING] For this reason, future Maven versions might no longer
support building such malformed projects.
[INFO] [WARNING]
[INFO] [INFO]
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO] Building multi 1.27
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO]
[INFO] [INFO] >>> maven-source-plugin:2.1.2:jar (attach-sources) @ multi >>>
[INFO] [INFO]
[INFO] [INFO] <<< maven-source-plugin:2.1.2:jar (attach-sources) @ multi <<<
[INFO] [INFO]
[INFO] [INFO] --- maven-source-plugin:2.1.2:jar (attach-sources) @ multi ---
[INFO] [INFO]
[INFO] [INFO] --- maven-javadoc-plugin:2.7:jar (attach-javadocs) @ multi ---
[INFO] [INFO] Not executing Javadoc as the project is not a Java
classpath-capable package
[INFO] [INFO]
[INFO] [INFO] --- maven-install-plugin:2.3.1:install (default-install) @
multi ---
[INFO] [INFO] Installing
C:\Temp\releasetest\multi\target\checkout\multi\pom.xml to C:\Dokumente und
Einstellungen\aek\.m2\repository\de\aek\test\multi\1.27\muti-1.27.pom
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] [INFO] Total time: 8.843s
[INFO] [INFO] Finished at: Thu Mar 03 15:53:11 CET 2011
[INFO] [INFO] Final Memory: 5M/10M
[INFO] [INFO]
------------------------------------------------------------------------
[INFO] Cleaning up after release...
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 12.797s
[INFO] Finished at: Thu Mar 03 15:53:11 CET 2011
[INFO] Final Memory: 3M/7M
[INFO]
------------------------------------------------------------------------ {code}
> maven-release-plugin causes mercurial scm provider to fail when only a module
> is released
> -----------------------------------------------------------------------------------------
>
> Key: SCM-612
> URL: https://jira.codehaus.org/browse/SCM-612
> Project: Maven SCM
> Issue Type: Bug
> Components: maven-scm-provider-mercurial (hg)
> Affects Versions: 1.4, 1.5
> Reporter: Andreas Ebbert-Karroum
> Assignee: Olivier Lamy
> Attachments: hg-repo.zip
>
>
> Problem as described on the [maven-users mailing
> list|http://maven.40175.n5.nabble.com/How-to-release-a-single-module-in-a-Mercurial-repository-tp3406421p3406421.html].
> Basically it is not possible to release a single module from a multi-module
> project with mercurial as scm provider.
> h2. When trying with current 1.5-SNAPSHOT:
> {code}
> Caused by: org.apache.maven.scm.ScmException: This provider doesn't support
> tagging subsets of a directory
> at
> org.apache.maven.scm.provider.hg.command.tag.HgTagCommand.executeTagCommand(HgTagCommand.java:77)
> at
> org.apache.maven.scm.command.tag.AbstractTagCommand.executeCommand(AbstractTagCommand.java:81)
> at
> org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
> ... 29 more
> {code}
> h2. When trying with 1.4 release
> It is more complicated, but also does not work. It boils down to having a
> mandatory pom.xml in the repository root and scm url messed up during the
> release:prepare and release:perform phases. See mentioned email for more
> details.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira