簡體   English   中英

檢查Git存儲庫並使用Maven SCM切換到特定分支

[英]checking out a Git repository and switch to a specific branch using Maven SCM

我想使用Maven來檢查Git存儲庫。 在我們的特定用例中,這有意義,因為這個Git存儲庫包含我們需要包含在構建過​​程中的文件。

由於項目的性質,Git存儲庫可能具有不同的分支。 所以很簡單:scm:git:git@github.example.com:myproject / project.git

不會工作,因為這將結帳主人。 我想例如分支“3.0V3”

有沒有辦法可以指定哪個分支Maven會結賬?

您可以使用maven scm插件的 <scmVersion><scmVersionType>屬性來實現此目的。

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

 <build>
    <plugins>
        ...
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <version>1.8.1</version>
          <configuration>
              <connectionType>developerConnection</connectionType>
              <scmVersion>branch-name</scmVersion>
              <scmVersionType>branch</scmVersionType>
          </configuration>
        </plugin>
    </plugins>
    ...
  </build>
  ...
</project>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM