我做了一个mod,现在我想编译它,我按照一个教程尝试编译,但是我有一个错误。请告诉我我做错了。
谢谢。

终奌站:

* Where:
Build file '/Users/Will/Dropbox/forge/build.gradle' line: 20

* What went wrong:
Could not compile build file '/Users/Will/Dropbox/forge/build.gradle'.
> startup failed:
  build file '/Users/Will/Dropbox/forge/build.gradle': 20: Invalid variable name. Must start with a letter but was: “1”
  . At [20:11]  @ line 20, column 11.
     version = “1”
               ^

  1 error


* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 6.669 secs


Build.grade:

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”
group = “com.candymod.mincoder”
archivesBaseName = “Candymod”

minecraft {
    version = "1.7.10-10.13.2.1230"
    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'
    }
}


多谢您决定协助。

最佳答案

如果您使用的是mac(我假设您来自您的路径),并且使用的是可怕的TextEdit程序,则需要进入设置和turn off "smart quotes"。在键入时,TextEdit中的“智能报价”功能会自动将普通报价"替换为报价报价



version = “1”


应该

version = "1"


细微的差别,但是就在那里。无论在何处使用这些工具,您都会遇到相同的问题,例如

group = “com.candymod.mincoder”
archivesBaseName = “Candymod”


长期解决方案

获取面向编码的编辑器,例如Sublime,以替换您对TextEdit的使用,TextEdit具有许多优点,包括导航和语法着色,使编码更容易。

关于java - Minecraft Forge Mod编译错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31242615/

10-11 02:20