LoginSignup
34
34

More than 5 years have passed since last update.

オレオレライブラリのMavenレポジトリをGithubに作ってしまう

Posted at

Mavenセントラルに登録するほどでもなく、自前でMavenレポジトリを構築するほどでもない。そんなオレオレライブラリ達の置き場に困ることがよくある。
これまではjarごとバージョン管理対象にしてmvn install:install-fileしてね。なスタンスだったのだがGithub PagesをMavenレポジトリにすることができるらしいのでやってみた。

Github Pagesを作成する

Githubでレポジトリを作成。[ユーザー名].github.ioという名前にするとユーザーページができあがる。

適当な場所にクローンしておく。

pom.xml設定(オレオレライブラリ側)

オレオレライブラリのデプロイ先をGithub Pagesをクローンした場所にする。

<properties>
  <github.repo.directory>/path/to/master-of-sugar.github.io/mvn-repo</github.repo.directory>
</properties>
<distributionManagement>
  <repository>
    <id>internal.repo</id>
    <name>Local Github Pages</name>
    <url>file://${github.repo.directory}</url>
  </repository>
</distributionManagement>

デプロイする

mvn deploy

pom.xmlで指定したGithub Pagesのクローンディレクトリに配置される。

Mavenレポジトリ(Github Pages)に登録する

普通にGithub Pagesにpushするだけ。

git push origin master

pom.xml設定(使う側)

オレオレライブラリの取得元であるGithub Pagesを登録する。

<repositories>
  <repository>
    <id>github</id>
    <url>http://master-of-sugar.github.io/mvn-repo/</url>
  </repository>
</repositories>

これでmvn install:install-fileしなくても使える。わー簡単。

34
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
34
34