[ 
https://issues.apache.org/jira/browse/SCM-860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Kutschke updated SCM-860:
---------------------------------
    Description: 
For reference: 
[https://stackoverflow.com/questions/48689960/maven-scm-plugin-and-relative-paths]

 

When the pom is not at the root directory, the add goal creates a command that 
includes a relative path from the pom's directory instead of the root 
directory. Either that, or relative paths like /.. are dropped.

 Directory structure of the project:
*  .git
** src
*** parent
**** pom.xml
*** submodule
**** pom.xml
**** addme.product

Example pom:

 
{code: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/xsd/maven-4.0.0.xsd";>


    <scm>
    <developerConnection>scm:git:file://../../.git</developerConnection>
  </scm>


    <modelVersion>4.0.0</modelVersion>
    <groupId>grp</groupId>
    <artifactId>artif</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>


    <modules>
      <module>../submodule</module>     
    </modules>

    </properties>

    <build>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <localCheckout>true</localCheckout>
                    <preparationGoals>
                        
org.eclipse.tycho:tycho-versions-plugin:${tycho-version}:update-eclipse-metadata
 
                        org.apache.maven.plugins:maven-scm-plugin:1.9.5:add 
                        <!-- 
org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin -->
                    </preparationGoals>
                    <completionGoals>
                        
org.eclipse.tycho:tycho-versions-plugin:${tycho-version}:update-eclipse-metadata
 
                        org.apache.maven.plugins:maven-scm-plugin:1.9.5:add 
                        <!-- 
org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin -->
                    </completionGoals>
                </configuration>
           </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-scm-plugin</artifactId>
               <version>1.9.5</version>
               <executions>
                 <execution>
                   <id>default-cli</id>
                   <goals>
                     <goal>add</goal>
                     <goal>checkin</goal>
                   </goals>
                   <configuration>
                     
<includes>**/META-INF/MANIFEST.MF,**/feature.xml,**/*.product</includes>
                     <excludes>**/target/**</excludes>
                   <message>Changing the version to reflect the pom versions 
for the release</message>
                   <basedir>${project.basedir}/../..</basedir>
                   <workingDirectory>${project.basedir}/../..</workingDirectory>
                   </configuration>
                 </execution>
               </executions>
             </plugin>
        </plugins>

</project>
{code}

Leads to output like this:

[INFO] Executing: cmd.exe /X /C "git add -- 
src\parent\src\submodule\addme.product"
[INFO] Working directory: D:\git\project\src\parent\..\..
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: pathspec 'src\parent\src\submodule\addme.product' did not match 
any files


I think this is the jgit provider, but am unsure how to check that it is not 
the gitexe provider.

  was:
For reference: 
[https://stackoverflow.com/questions/48689960/maven-scm-plugin-and-relative-paths]

 

When the pom is not at the root directory, the add goal creates a command that 
includes a relative path from the pom's directory instead of the root 
directory. Either that, or relative paths like /.. are dropped.

 Directory structure of the project:
 - .git
 - src
    - parent
       - pom.xml
    - submodule
       - pom.xml
       - addme.product

Example pom:

 
{code: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/xsd/maven-4.0.0.xsd";>


    <scm>
    <developerConnection>scm:git:file://../../.git</developerConnection>
  </scm>


    <modelVersion>4.0.0</modelVersion>
    <groupId>grp</groupId>
    <artifactId>artif</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>


    <modules>
      <module>../submodule</module>     
    </modules>

    </properties>

    <build>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <localCheckout>true</localCheckout>
                    <preparationGoals>
                        
org.eclipse.tycho:tycho-versions-plugin:${tycho-version}:update-eclipse-metadata
 
                        org.apache.maven.plugins:maven-scm-plugin:1.9.5:add 
                        <!-- 
org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin -->
                    </preparationGoals>
                    <completionGoals>
                        
org.eclipse.tycho:tycho-versions-plugin:${tycho-version}:update-eclipse-metadata
 
                        org.apache.maven.plugins:maven-scm-plugin:1.9.5:add 
                        <!-- 
org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin -->
                    </completionGoals>
                </configuration>
           </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-scm-plugin</artifactId>
               <version>1.9.5</version>
               <executions>
                 <execution>
                   <id>default-cli</id>
                   <goals>
                     <goal>add</goal>
                     <goal>checkin</goal>
                   </goals>
                   <configuration>
                     
<includes>**/META-INF/MANIFEST.MF,**/feature.xml,**/*.product</includes>
                     <excludes>**/target/**</excludes>
                   <message>Changing the version to reflect the pom versions 
for the release</message>
                   <basedir>${project.basedir}/../..</basedir>
                   <workingDirectory>${project.basedir}/../..</workingDirectory>
                   </configuration>
                 </execution>
               </executions>
             </plugin>
        </plugins>

</project>
{code}

Leads to output like this:

[INFO] Executing: cmd.exe /X /C "git add -- 
src\parent\src\submodule\addme.product"
[INFO] Working directory: D:\git\project\src\parent\..\..
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: pathspec 'src\parent\src\submodule\addme.product' did not match 
any files


I think this is the jgit provider, but am unsure how to check that it is not 
the gitexe provider.


> add goal creates creates wrong paths if parent pom is not at root directory
> ---------------------------------------------------------------------------
>
>                 Key: SCM-860
>                 URL: https://issues.apache.org/jira/browse/SCM-860
>             Project: Maven SCM
>          Issue Type: Bug
>          Components: maven-scm-provider-jgit
>    Affects Versions: 1.9.5
>         Environment: Windows, mvn 3.5.2, mvn:scm 1.9.5
>            Reporter: Michael Kutschke
>            Priority: Major
>
> For reference: 
> [https://stackoverflow.com/questions/48689960/maven-scm-plugin-and-relative-paths]
>  
> When the pom is not at the root directory, the add goal creates a command 
> that includes a relative path from the pom's directory instead of the root 
> directory. Either that, or relative paths like /.. are dropped.
>  Directory structure of the project:
> *  .git
> ** src
> *** parent
> **** pom.xml
> *** submodule
> **** pom.xml
> **** addme.product
> Example pom:
>  
> {code: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/xsd/maven-4.0.0.xsd";>
>     <scm>
>     <developerConnection>scm:git:file://../../.git</developerConnection>
>   </scm>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>grp</groupId>
>     <artifactId>artif</artifactId>
>     <version>1.0.0</version>
>     <packaging>pom</packaging>
>     <modules>
>       <module>../submodule</module>     
>     </modules>
>     </properties>
>     <build>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-release-plugin</artifactId>
>                 <version>2.5.3</version>
>                 <configuration>
>                     <autoVersionSubmodules>true</autoVersionSubmodules>
>                     <localCheckout>true</localCheckout>
>                     <preparationGoals>
>                         
> org.eclipse.tycho:tycho-versions-plugin:${tycho-version}:update-eclipse-metadata
>  
>                         org.apache.maven.plugins:maven-scm-plugin:1.9.5:add 
>                         <!-- 
> org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin -->
>                     </preparationGoals>
>                     <completionGoals>
>                         
> org.eclipse.tycho:tycho-versions-plugin:${tycho-version}:update-eclipse-metadata
>  
>                         org.apache.maven.plugins:maven-scm-plugin:1.9.5:add 
>                         <!-- 
> org.apache.maven.plugins:maven-scm-plugin:1.9.5:checkin -->
>                     </completionGoals>
>                 </configuration>
>            </plugin>
>             <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-scm-plugin</artifactId>
>                <version>1.9.5</version>
>                <executions>
>                  <execution>
>                    <id>default-cli</id>
>                    <goals>
>                      <goal>add</goal>
>                      <goal>checkin</goal>
>                    </goals>
>                    <configuration>
>                      
> <includes>**/META-INF/MANIFEST.MF,**/feature.xml,**/*.product</includes>
>                      <excludes>**/target/**</excludes>
>                    <message>Changing the version to reflect the pom versions 
> for the release</message>
>                    <basedir>${project.basedir}/../..</basedir>
>                    
> <workingDirectory>${project.basedir}/../..</workingDirectory>
>                    </configuration>
>                  </execution>
>                </executions>
>              </plugin>
>         </plugins>
> </project>
> {code}
> Leads to output like this:
> [INFO] Executing: cmd.exe /X /C "git add -- 
> src\parent\src\submodule\addme.product"
> [INFO] Working directory: D:\git\project\src\parent\..\..
> [ERROR] Provider message:
> [ERROR] The git-add command failed.
> [ERROR] Command output:
> [ERROR] fatal: pathspec 'src\parent\src\submodule\addme.product' did not 
> match any files
> I think this is the jgit provider, but am unsure how to check that it is not 
> the gitexe provider.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to