跳转至内容
  • 版块
  • 最新
  • 标签
  • 热门
  • 世界
  • 用户
  • 群组
  • 精华
皮肤
  • 浅色
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • 深色
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(不使用皮肤)
  • 不使用皮肤
折叠

最MC

  1. 主页
  2. 开发交流
  3. 编程开发
  4. [资源]分享针对国内开发者的Maven源镜像

[资源]分享针对国内开发者的Maven源镜像

已定时 已固定 已锁定 已移动 编程开发
1 帖子 1 发布者 0 浏览 1 关注中
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • lss233L
    lss233L
    lss233
    发表于 最后由 编辑
    Lv1 泥土
    #1

    记得最开始使用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 的情况,应该是不会影响你的构建程序自动下载文件的。
    如果本仓库无法正常使用,请提醒我,我会尽快修复。

    最后
    本人是没有稳定收入的学生,维护这个镜像服务需要不小的开销。
    关于本镜像源的更新会首发于本人博客,你可以点击这里访问。
    如果这个东西对您有帮助、想支持我继续下去,可以了解一下我在爱发电的主页喔~

    1 条回复 最后回复
    0

    你好!看起来您对这段对话很感兴趣,但您还没有一个账号。

    厌倦了每次访问都刷到同样的帖子?您注册账号后,您下次访问时都将自动回到上次浏览的位置,并可选择接收新回复的通知(通过电子邮件或推送通知)。您还可以收藏帖子、为帖子点赞,以此向其他社区成员表达您的感谢。

    有了你的建议,这篇帖子会更精彩哦 💗

    注册 登录
    回复
    • 在新帖中回复
    登录后回复
    • 从旧到新
    • 从新到旧
    • 最多赞同


    • 登录

    • 没有帐号? 注册

    • 搜索
    Powered by NodeBB Contributors
    • 第一个帖子
      最后一个帖子
    0
    • 版块
    • 最新
    • 标签
    • 热门
    • 世界
    • 用户
    • 群组
    • 精华
    • 搜索