- UID
- 102568
- 阅读权限
- 100
- 注册时间
- 2016-8-1
- 最后登录
- 1970-1-1
- 在线时间
- 小时
- 人气
- 点
- MC币
- 个
- 贡献
- 点
|
记得最开始使用Maven的时候,基本上大部分时间都花在寻找依赖和下载依赖上。
许多API的作者也都是把自己的工件放在自己的maven仓库上,
如果你使用Maven或者Gradle,那么你不仅要在pom.xml中写dependency,还要写一个repository。
有些仓库在国内访问还很慢、甚至无法打开,这大大降低了开发效率。
如果你现在正为此苦恼的话,那么试试我搭建的仓库吧!
介绍
仓库地址:https://lss233.com/artifactory/minecraft
这个仓库镜像了以下内容:
- Spigot的Snapshots (主要包含了spigot-api, bukkit-api)
- Spongepowered (主要包含了spongeapi, spongecommon 以及其他开发sponge插件可能用到的工件)
- forge(镜像了files.minecraftforge.net/maven)
- nexus.hc.to(主要包含了vault-api, heroes, Residence等工件)
- placeholderapi-repo(主要包含了PlaceholderAPI)
- sk89q-repo (主要包含了worldedit, worldguard, craftbook,dynmap-api 等工件 )
- dmulloy2-snapshots(主要包含了ProtocolLib等工件)
- ess3-repo (主要包含了Essentials插件的一些工件)
- dakanilabs-repo (主要包含了SQLibrary, PlayerPoints等一些工件)
- kk-central (主要包含了KCauldron等一些工件)
- Phoenix(主要包含了PhoenixAPI)
- destroystokyo-repo(主要包含paper-api, paperclip, waterfall等工件)
- lex-snapshots(主要包含了NeptuneLib)
- sonatype(主要包含了bungeecord-api等一大堆工件)
- codemc(主要包含了craftbukkit、spigot服务端)
- nukkit (主要包含了nukkit, nukkit-parent)
- libraries.minecraft.net
使用方法
对于使用Maven进行开发的小伙伴
打开pom.xml ,在 <repositories> ... </repositories> 代码块中加入:
- <repository>
- <id> lss233-minecraft </id>
- <name> Lss233's Minecraft Repository </name>
- <url>https://lss233.com/artifactory/minecraft</url>
- </repository>
复制代码 然后就可以把其他已经在本仓库中的 <repository> ... </repository> 删除啦。
Gradle Wrapper加速
通常首次使用 gradlew 的时候总会从Gradle官网缓慢地下载gradle.
本人对此也提供了一个简单的镜像。
加速方法:
打开项目中的 gradle/wrapper/gradle-wrapper.properties 文件,
将 services.gradle.org/distributions 替换为 lss233.com/artifactory/gradle-dist 即可。
对于使用Gradle进行Forge Mod开发的小伙伴
把build.gradle里
- maven {
- name = "forge"
- url = "http://files.minecraftforge.net/maven"
- }
复制代码 替换成
- maven {
- name = "forge"
- url = "https://lss233.com/artifactory/minecraft"
- }
复制代码 就可以提升下载速度啦,还能避免下载失败的问题呢。
高版本MDK
如果使用高版本的MDK,可能还会遇到 jcenter 无法访问的现象。
解决方法:
由于仓库中已经包含JCenter,您可以直接将build.gradle中的 jcenter() 删除。
完整版的build.gradle参考:
1.12.2
- buildscript {
- repositories {
- jcenter()
- maven { url = "https://lss233.com/artifactory/minecraft" }
- }
- dependencies {
- classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
- }
- }
- apply plugin: 'net.minecraftforge.gradle.forge'
- version = "1.0"
- group= "com.yourname" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
- archivesBaseName = "modid"
- sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
- compileJava {
- sourceCompatibility = targetCompatibility = '1.8'
- }
- minecraft {
- version = "1.12.2-14.23.5.2808"
- runDir = "run"
- // the mappings can be changed at any time, and must be in the following format.
- // snapshot_YYYYMMDD snapshot are built nightly.
- // stable_# stables are built at the discretion of the MCP team.
- // Use non-default mappings at your own risk. they may not always work.
- // simply re-run your setup task after changing the mappings to update your workspace.
- mappings = "snapshot_20171003"
- // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
- }
- dependencies {
- // you may put jars on which you depend on in ./libs
- // or you may define them like so..
- //compile "some.group:artifact:version:classifier"
- //compile "some.group:artifact:version"
- // real examples
- //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
- //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
- // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
- //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
- // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
- // except that these dependencies get remapped to your current MCP mappings
- //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
- //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
- // for more info...
- // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
- // http://www.gradle.org/docs/current/userguide/dependency_management.html
- }
- processResources {
- // this will ensure that this task is redone when the versions change.
- inputs.property "version", project.version
- inputs.property "mcversion", project.minecraft.version
- // replace stuff in mcmod.info, nothing else
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
- // replace version and mcversion
- expand 'version':project.version, 'mcversion':project.minecraft.version
- }
- // copy everything else except the mcmod.info
- from(sourceSets.main.resources.srcDirs) {
- exclude 'mcmod.info'
- }
- }
复制代码
1.7.10:
- buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- maven {
- url = "https://lss233.com/artifactory/minecraft"
- }
- }
- dependencies {
- classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
- }
- }
- apply plugin: 'forge'
- version = "1.0"
- group= "com.yourname" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
- archivesBaseName = "modid"
- minecraft {
- version = "1.7.10-10.13.4.1558-1.7.10"
- runDir = "eclipse"
- }
- dependencies {
- // you may put jars on which you depend on in ./libs
- // or you may define them like so..
- //compile "some.group:artifact:version:classifier"
- //compile "some.group:artifact:version"
-
- // real examples
- //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
- //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
- // for more info...
- // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
- // http://www.gradle.org/docs/current/userguide/dependency_management.html
- compile project(':PokeMarketCommon')
- }
- processResources
- {
- // this will ensure that this task is redone when the versions change.
- inputs.property "version", project.version
- inputs.property "mcversion", project.minecraft.version
- // replace stuff in mcmod.info, nothing else
- from(sourceSets.main.resources.srcDirs) {
- include 'mcmod.info'
-
- // replace version and mcversion
- expand 'version':project.version, 'mcversion':project.minecraft.version
- }
-
- // copy everything else, thats not the mcmod.info
- from(sourceSets.main.resources.srcDirs) {
- exclude 'mcmod.info'
- }
- }
复制代码
对于使用Gradle进行插件开发的小伙伴
在build.gradle里的 repositories { .... } 里面加入一行:
- maven {
- url 'https://lss233.com/artifactory/minecraft/'
- }
复制代码
对于啥都不用的小伙伴
你可以用浏览器直接打开本仓库的网址,自行寻找你想要的依赖。
如果您有什么需要补充的仓库,或者想要提交自己的工件,也可以告诉我喔。
另外,如果出现 504 Gateway Time-out 的情况,应该是不会影响你的构建程序自动下载文件的。
如果本仓库无法正常使用,请提醒我,我会尽快修复。
最后
本人是没有稳定收入的学生,维护这个镜像服务需要不小的开销。
关于本镜像源的更新会首发于本人博客,你可以点击这里访问。
如果这个东西对您有帮助、想支持我继续下去,可以了解一下我在爱发电的主页喔~
|
评分
-
查看全部评分
|