mirror of
https://github.com/fankes/maven-repository.git
synced 2025-09-04 01:35:16 +08:00
Update README.md
This commit is contained in:
104
README.md
104
README.md
@@ -4,12 +4,8 @@
|
|||||||
|
|
||||||
This is a simple Maven repository by using GitHub to manage dependencies.
|
This is a simple Maven repository by using GitHub to manage dependencies.
|
||||||
|
|
||||||
You can fork this repository as a template to create your own personal Maven repository, provided it maintains and follows the `Apache-2.0` license.
|
|
||||||
|
|
||||||
这是一个使用 GitHub 管理依赖的简单 Maven 存储库。
|
这是一个使用 GitHub 管理依赖的简单 Maven 存储库。
|
||||||
|
|
||||||
你可以复刻此存储库作为模版创建自己的私人 Maven 存储库,但必须保持并遵循 `Apache-2.0` 许可协议。
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The directory `repository` is the repository, which contains two parts: `releases` (release version) and `snapshots` (snapshots), where all Maven project artifacts are stored.
|
The directory `repository` is the repository, which contains two parts: `releases` (release version) and `snapshots` (snapshots), where all Maven project artifacts are stored.
|
||||||
@@ -19,13 +15,13 @@ Reference this repository using the link below.
|
|||||||
> Releases
|
> Releases
|
||||||
|
|
||||||
```
|
```
|
||||||
https://raw.githubusercontent.com/[organization name or username]/[repository name]/[branch name]/repository/releases
|
https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
|
||||||
```
|
```
|
||||||
|
|
||||||
> SnapShots
|
> SnapShots
|
||||||
|
|
||||||
```
|
```
|
||||||
https://raw.githubusercontent.com/[organization name or username]/[repository name]/[branch name]/repository/snapshots
|
https://raw.githubusercontent.com/fankes/maven-repository/main/repository/snapshots
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage in Gradle Projects
|
### Usage in Gradle Projects
|
||||||
@@ -37,12 +33,12 @@ You can use this repository in any Gradle project.
|
|||||||
```kotlin
|
```kotlin
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "personal-maven-repository-releases"
|
name = "fankes-maven-releases"
|
||||||
setUrl("https://raw.githubusercontent.com/[organization name or user name]/[repository name]/[branch name]/repository/releases")
|
setUrl("https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases")
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "personal-maven-repository-snapshots"
|
name = "fankes-maven-snapshots"
|
||||||
setUrl("https://raw.githubusercontent.com/[organization name or username]/[repository name]/[branch name]/repository/snapshots")
|
setUrl("https://raw.githubusercontent.com/fankes/maven-repository/main/repository/snapshots")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -51,40 +47,10 @@ You can also use [SweetDependency](https://github/HighCapable/SweetDependency) t
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
repositories:
|
repositories:
|
||||||
personal-maven-repository-releases:
|
fankes-maven-releases:
|
||||||
url: https://raw.githubusercontent.com/[organization name or username]/[repository name]/[branch name]/repository/releases
|
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
|
||||||
personal-maven-repository-snapshots:
|
fankes-maven-snapshots:
|
||||||
url: https://raw.githubusercontent.com/[organization name or username]/[repository name]/[branch name]/repository/snapshots
|
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/snapshots
|
||||||
```
|
|
||||||
|
|
||||||
#### Publish Artifacts to Repository
|
|
||||||
|
|
||||||
It is recommended to use vanniktech's [gradle-maven-publish-plugin](https://vanniktech.github.io/gradle-maven-publish-plugin) to publish Maven artifacts.
|
|
||||||
|
|
||||||
Below is a reference for how to configure a repository to publish to.
|
|
||||||
|
|
||||||
You can publish the repository directly to the `.gradle/personal-maven-repository` directory under your local user directory, and then set `personal-maven-repository` as a git repository.
|
|
||||||
|
|
||||||
Connect the `personal-maven-repository` directory to GitHub.
|
|
||||||
|
|
||||||
After each release of artifacts, perform a `git commit` and `git push` to synchronize the current repository.
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
val repositoryDir = gradle.gradleUserHomeDir
|
|
||||||
.resolve("personal-maven-repository")
|
|
||||||
.resolve("repository")
|
|
||||||
maven {
|
|
||||||
name = "PersonalMavenReleases"
|
|
||||||
url = repositoryDir.resolve("releases").toURI()
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "PersonalMavenSnapShots"
|
|
||||||
url = repositoryDir.resolve("snapshots").toURI()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 使用方法
|
## 使用方法
|
||||||
@@ -96,13 +62,13 @@ publishing {
|
|||||||
> Releases
|
> Releases
|
||||||
|
|
||||||
```
|
```
|
||||||
https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支名]/repository/releases
|
https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
|
||||||
```
|
```
|
||||||
|
|
||||||
> SnapShots
|
> SnapShots
|
||||||
|
|
||||||
```
|
```
|
||||||
https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支名]/repository/snapshots
|
https://raw.githubusercontent.com/fankes/maven-repository/main/repository/snapshots
|
||||||
```
|
```
|
||||||
|
|
||||||
针对中国大陆地区无法访问 `raw.githubusercontent.com` 可以使用加速服务,例如 [GitMirror](https://gitmirror.com/)。
|
针对中国大陆地区无法访问 `raw.githubusercontent.com` 可以使用加速服务,例如 [GitMirror](https://gitmirror.com/)。
|
||||||
@@ -116,12 +82,12 @@ https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支
|
|||||||
```kotlin
|
```kotlin
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
name = "personal-maven-repository-releases"
|
name = "fankes-maven-releases"
|
||||||
setUrl("https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支名]/repository/releases")
|
setUrl("https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases")
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "personal-maven-repository-snapshots"
|
name = "fankes-maven-snapshots"
|
||||||
setUrl("https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支名]/repository/snapshots")
|
setUrl("https://raw.githubusercontent.com/fankes/maven-repository/main/repository/snapshots")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -130,40 +96,10 @@ repositories {
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
repositories:
|
repositories:
|
||||||
personal-maven-repository-releases:
|
fankes-maven-releases:
|
||||||
url: https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支名]/repository/releases
|
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
|
||||||
personal-maven-repository-snapshots:
|
fankes-maven-snapshots:
|
||||||
url: https://raw.githubusercontent.com/[组织名或用户名]/[存储库名]/[分支名]/repository/snapshots
|
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/snapshots
|
||||||
```
|
|
||||||
|
|
||||||
#### 发布工件到存储库
|
|
||||||
|
|
||||||
推荐使用 vanniktech 的 [gradle-maven-publish-plugin](https://vanniktech.github.io/gradle-maven-publish-plugin) 来发布 Maven 工件。
|
|
||||||
|
|
||||||
下面是一个配置发布到的存储库方式的参考。
|
|
||||||
|
|
||||||
你可以直接将存储库发布到本机用户目录下的 `.gradle/personal-maven-repository` 目录中,然后将 `personal-maven-repository` 设置为 git 存储库。
|
|
||||||
|
|
||||||
将 `personal-maven-repository` 目录连接到 GitHub。
|
|
||||||
|
|
||||||
每次发布工件后,进行一次 `git commit` 和 `git push` 即可同步当前存储库。
|
|
||||||
|
|
||||||
```kotlin
|
|
||||||
publishing {
|
|
||||||
repositories {
|
|
||||||
val repositoryDir = gradle.gradleUserHomeDir
|
|
||||||
.resolve("personal-maven-repository")
|
|
||||||
.resolve("repository")
|
|
||||||
maven {
|
|
||||||
name = "PersonalMavenReleases"
|
|
||||||
url = repositoryDir.resolve("releases").toURI()
|
|
||||||
}
|
|
||||||
maven {
|
|
||||||
name = "PersonalMavenSnapShots"
|
|
||||||
url = repositoryDir.resolve("snapshots").toURI()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
Reference in New Issue
Block a user