我做了一个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(我假设您是Mac的用户),并且使用的是可怕的TextEdit程序,那么您需要进入设置并关闭“智能引号”。键入时,TextEdit中的“智能引号”功能会自动将普通引号替换"为引号“。
"
“
即
version = “1”
应该
version = "1"
细微的差别,但是就在那里。无论在何处使用这些工具,都会遇到相同的问题,例如
group = “com.candymod.mincoder” archivesBaseName = “Candymod”
长期解决方案
获取面向代码的编辑器,例如Sublime,以替换您对TextEdit的使用,TextEdit具有许多优点,包括导航和语法着色,使编码更容易。