Maven SCM插件和相对路径 [英] Maven SCM plugin and relative paths

查看:171
本文介绍了Maven SCM插件和相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目录结构看起来像这样:

My directory structure looks somewhat like this:

  • .git
  • src
    • 父母
      • pom.xml
      • .git
      • src
        • parent
          • pom.xml
          • pom.xml
          • addme.product

          我的pom看起来像这样:

          My pom looks like this:

          <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>
          

          运行mvn release:prepare时,我收到一条错误消息

          When I run mvn release:prepare, I get an error saying that

          [错误]致命:pathspec'src \ parent \ src \ submodule \ addme.product'确实 没有任何文件

          [ERROR] fatal: pathspec 'src\parent\src\submodule\addme.product' did not match any files

          因此,插件找到了应添加的文件,但是在创建命令行时不遵循正确的根目录.如何解决此问题,而不更改父pom的位置?

          So, the plugin finds the files it should add, but when creating the command line doesn't respect the correct root directory. How do I fix this, without changing the location of the parent pom?

          推荐答案

          我遇到了类似的问题(我的根POM有一个位于子文件夹中的父配置POM).我只能通过创建适当的" POM和文件夹层次结构来解决此问题,这意味着:

          I ran into a similar problem (my root POM had a parent configuration POM, which was located in a subfolder). I was only able to solve this by creating a "proper" POM and folder hierarchy, meaning:

          • 根POM应该位于项目的根文件夹中
          • 子模块应该是项目根文件夹的子文件夹,并且文件夹结构应该反映在POM的文件夹中.
          • 源文件夹应该是模块的各个子文件夹

          这篇关于Maven SCM插件和相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆