[ 
https://issues.apache.org/jira/browse/SCM-612?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17962244#comment-17962244
 ] 

ASF GitHub Bot commented on SCM-612:
------------------------------------

jira-importer commented on issue #822:
URL: https://github.com/apache/maven-scm/issues/822#issuecomment-2964625936

   **[Andreas 
Ebbert-Karroum](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=andreasek)**
 commented
   
   Hi,
   
   I haven't tried it, but I doubt that this change is fixing everything that I 
described on the mailing list.
   
   > ## 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
   > 
MRELEA[SE-457](https://issues.apache.org/jira/browse/SE-457)<http://jira.codehaus.org/browse/MRELEASE-457>is
 fixed.
   > 
   > ## 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
   > 
   > ## 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.
   > 
   > ## 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.
   > 
   > ## 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.
   > 
   > ## 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.
   > 
   > ## 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.
   
   ```
   <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> 
   ```
   
   ```
   <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> 
   ```
   
   ```
   <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> 
   ```
   
   ```
   C:\Temp\releasetest>mvn -pl multi --offline --batch-mode release:prepare 
   [INFO] Scanning for projects... 
   [INFO] 
   [INFO] 
   ----------------------------------------------------------------------

> maven-release-plugin causes mercurial scm provider to fail when only a module 
> is released
> -----------------------------------------------------------------------------------------
>
>                 Key: SCM-612
>                 URL: https://issues.apache.org/jira/browse/SCM-612
>             Project: Maven SCM (Moved to GitHub Issues)
>          Issue Type: Bug
>          Components: maven-scm-provider-mercurial (hg)
>    Affects Versions: 1.4, 1.5
>            Reporter: Andreas Ebbert-Karroum
>            Assignee: Olivier Lamy
>            Priority: Major
>         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 was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to