github のリポジトリ (のデフォルト ブランチ) をエクスポート/チェックアウトするには、maven-scm-plugin を使用する必要があります。ユーザー名/パスワードをどこかにハードコードすると、これを機能させることができますが、ssh キーまたはローカル ファイルシステムのパスワード マネージャーを使用することはできません。
コマンド プロンプトで、「git clone git@github.com:org/repo」または「git clone https://github.com/org/repo」を実行すると、手動で再入力しなくても完了します。ユーザー名/パスワードの詳細。
私のプラグインでは、connectionUrl を scm:git: https://github.com/org/repo " にすることができ、"-Dusername=foo -Dpassword=bar" を渡すことができます。ユーザー名/パスワード (foo/bar) をプレーンテキストでどこかに。
それを setting.xmlに入れてargs として渡し、それらをpomファイル自体に入れるというアドバイスを見てきました。そして、ssh 接続がサポートされているという証拠を見つけました。しかし、ssh 接続の実際の使用や、どこかにプレーン テキストのパスワードがない https 接続を見つけることができません。何かアドバイス?
私は次のように動作しました( -Dusername= -Dpassword= を渡す場合):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.4</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>checkout</goal>
</goals>
<id>perform-export</id>
<configuration>
<!-- Would be happy to get rid of provider -->
<providerImplementations>
<git>jgit</git>
</providerImplementations>
<!--
Want to use ssh, but cannot
<connectionUrl>scm:git:ssh://github.com/org/repo</connectionUrl>
-->
<connectionUrl>scm:git:https://github.com/org/repo</connectionUrl>
<exportDirectory>target</exportDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-jgit</artifactId>
<version>1.9.4</version>
</dependency>
</dependencies>