java—运行gradlew.bat和设置开发环境的问题

i1icjdpr  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(397)

我最近开始修改minecraft 1.7.10,我正在设置我的文件夹/环境。到目前为止,我所做的一切如下:;
将1.7.10src文件从forge网站提取到我计划修改的文件中。
在我的环境变量中创建了一个名为path的系统变量,它指向我的jdk。
运行gradlew.bat(失败)
这就是我失败的地方。我有一个主要的错误,我直接从命令提示符,使用命令/k开关,以保持它打开下面列出。
失败:生成失败,出现异常。
错误:配置根项目“modding project”时出现问题。
无法解析配置“:classpath”的所有依赖项。无法解析org.eclipse。equinox:common:[3.2.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:jobs:3.5.300-v20130429-1813:修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-快照>org.eclipse。core:contenttype:3.4.200-v20130326-1255:修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。equinox:preferences:3.5.100-v20130422-1538>未能列出org.eclipse的版本。equinox:common. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/common/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/common/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。equinox:preferences:[3.2.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:contenttype:3.4.200-v20130326-1255>未能列出org.eclipse的版本。equinox:preferences. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/preferences/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/preferences/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。equinox:registry:[3.2.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:contenttype:3.4.200-v20130326-1255>未能列出org.eclipse的版本。equinox:registry. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/registry/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/registry/maven-metadata.xml'. 从服务器收到状态代码501:https required无法解析org.eclipse.core。runtime:compatibility:[3.1.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:resources:3.2.1-r32x_v20060914>未能列出org.eclipse.core的版本。runtime:compatibility. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/core/runtime/compatibility/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/core/runtime/compatibility/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。core:expressions:[3.1.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:resources:3.2.1-r32x_v20060914>未能列出org.eclipse的版本。core:expressions. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/core/expressions/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/core/expressions/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。core:filesystem:[1.0.0,2.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:resources:3.2.1-r32x_v20060914>未能列出org.eclipse的版本。core:filesystem. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/core/filesystem/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/core/filesystem/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析组织。eclipse:osgi:[3.7.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出组织的版本。eclipse:osgi. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/osgi/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/osgi/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。equinox:common:[3.6.100,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出org.eclipse的版本。equinox:common. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/common/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/common/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。core:jobs:[3.2.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出org.eclipse的版本。core:jobs. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/core/jobs/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/core/jobs/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。equinox:registry:[3.4.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出org.eclipse的版本。equinox:registry. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/registry/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/registry/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。equinox:preferences:[3.4.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出org.eclipse的版本。equinox:preferences. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/preferences/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/preferences/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。core:contenttype:[3.3.0,4.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出org.eclipse的版本。core:contenttype. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/core/contenttype/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/core/contenttype/maven-metadata.xml'. 从服务器收到状态代码501:需要https无法解析org.eclipse。equinox:app:[1.0.0,2.0.0). 需要::修改project:unspecified >net.minecraftforge。gradle:forgegradle:1.2-snapshot>net.minecraftforge.srg2source:srg2source:3.2-snapshot>org.eclipse。core:runtime:3.9.0-v20130326-1255>未能列出org.eclipse的版本。equinox:app. > 无法从加载maven元数据http://repo1.maven.org/maven2/org/eclipse/equinox/app/maven-metadata.xml. > 无法获取'http://repo1.maven.org/maven2/org/eclipse/equinox/app/maven-metadata.xml'. 从服务器收到状态代码501:需要https
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。
生成失败
总时间:10.107秒
我可以根据请求提供--stacktrace,-info或--debug。。所以我不确定人们需要什么。无论如何谢谢你!
这是我的 build.gradle ```
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}

apply plugin: 'forge'

version = "1.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

minecraft {
version = "1.7.10-10.13.4.1614-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

}

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'
}

}

这是我的新版本。感谢你的帮助,现在缩小了范围。
失败:生成失败,出现异常。
错误:配置根项目“modding project”时出现问题。
无法解析配置“:classpath”的所有依赖项。无法下载项目“com.github”。jponge:lzma-java:1.3:lzma java.jar'>无法获取'http://repo1.maven.org/maven2/com/github/jponge/lzma-java/1.3/lzma-java-1.3.jar'. 从服务器收到状态代码501:需要https
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。
生成失败
总时间:7.195秒
rekjcdws

rekjcdws1#

据我所知 repo1.maven.org/maven2 不再支持http。这就是问题所在,因为1.7.10是与gradlewrapper v2.0一起提供的。在这个版本中,http是硬编码的。所以您需要自己添加存储库。
存储库声明如下所示:

maven {
  name = "maven"
  url = "https://repo1.maven.org/maven2"
}

您需要将它添加到构建脚本和项目中。
可能会这样:

buildscript {
    repositories {
        mavenCentral()
        maven {
           name = "maven"
           url = "https://repo1.maven.org/maven2"
        }
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        maven {
            name = "sonatype"
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
    }
}

apply plugin: 'forge'

version = "1.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"
repositories {
    maven {
        name = "maven"
        url = "https://repo1.maven.org/maven2"
    }
}

minecraft {
    version = "1.7.10-10.13.4.1614-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

}

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版本。但我不想这么做因为

相关问题