I would like to use Maven to checkout a Git repository. In our specific use-case this makes sense as this Git Repository contain files that we need to include in out build process.
Due to the nature of projects it is likely that the Git repository has different branches. So a simple: scm:git:[email protected]:myproject/project.git
Will not work as this will checkout master. I would like for example branch "3.0V3"
Is there a way I can specify which branch Maven will checkout?
You can use <scmVersion>
and <scmVersionType>
properties of maven scm plugin to achieve this.
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With