[英]Android Studio using Git: gradle-wrapper.jar in version control
Android Studio recommends using the gradle wrapper in the build work flow. Android Studio建议在构建工作流程中使用gradle包装器。 However, if you are using git for version control, .jar files are ignored and are said not to be checked in, which I get.
但是,如果您使用git进行版本控制,则将忽略.jar文件,并说不检入。 But my workflow is a little different than the average person.
但是我的工作流程与普通人有所不同。 We are also using Team Foundation Server and git both.
我们也同时使用Team Foundation Server和git。 The gradle build gets called using a custom MSBuildTask.
使用自定义MSBuildTask调用gradle构建。 Here is what my .gitignore file looks like:
这是我的.gitignore文件的样子:
# Built application files *.apk *.ap_ # Files for the Dalvik VM *.dex # Java class files *.class # Generated files bin/ gen/ # Gradle files .gradle/ build/ # Local configuration file (sdk path, etc) local.properties # Proguard folder generated by Eclipse proguard/ # Log Files *.log
The way it currently works is first we pull both from TFS and our git repo into a common location, then we merge the two, check the result back into TFS and push the result back to the git repo. 当前的工作方式是,首先我们将TFS和git repo都拉到一个公共位置,然后将两者合并,将结果检查回TFS并将结果推回到git repo。 After this is complete, the custom MSBuildTask is executed which basically just calls "gradlew build".
完成此操作后,将执行自定义MSBuildTask,该方法基本上只是调用“ gradlew构建”。 However, this fails because the gradle-wrapper.jar file isn't being pushed to git, its being ignored.
但是,这失败了,因为gradle-wrapper.jar文件没有被推送到git,而是被忽略了。 Any ideas on how to accomplish this?
关于如何做到这一点的任何想法? Thanks in advanced!
提前致谢!
As Peter mentioned, jars are not ignored due to your .gitignore file; 如Peter所述,由于您的 .gitignore文件,罐子不会被忽略; I guess the jars are ignored due to a .gitignore file located in a parent directory of your project directory.
我猜这些jars会由于位于项目目录的父目录中的.gitignore文件而被忽略。 Can that be the case ?
可以吗?
Anyhow, if that is the case, you can try using a negation in your .gitignore file, something like: 总之,如果是这样的话,你可以尝试在你的.gitignore文件中使用的否定,是这样的:
!**/*.jar
In that way, you override rules from a .gitignore file in one of the parent dirs. 这样,您可以从父目录之一中的.gitignore文件覆盖规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.