简体   繁体   English

Git中的Java config.properties文件

[英]Java config.properties file in Git

I have a Java Project which includes a config.properties file, in which this config.properties file has property values of paths to some executable files. 我有一个Java项目,其中包含config.properties文件,其中该config.properties文件具有一些可执行文件的路径的属性值。

I've configured a Git Repository (using EGit eclipse) tool, but the application is simply not working due to the fact that the config.properties file is not included in the Git Repository (in gitignore) since all users who will push/pull to Git will have a different config.properties file. 我已经配置了一个Git存储库(使用EGit eclipse)工具,但是由于config.properties文件未包含在Git存储库中(以gitignore格式),因此该应用程序无法正常工作,因为所有要推送/拉动的用户到Git将有一个不同的config.properties文件。 How shall I solve this problem? 我该如何解决这个问题? Is there a way to map the config file without including it to the repository. 有没有一种方法可以映射配置文件而不将其包含到存储库中。

Any help is highly appreciated, and I'm quite sure theres a solutions to this problem. 我们非常感谢您提供的任何帮助,我非常确定有解决此问题的方法。 'Thanks in advance. '提前致谢。

一种方法是gitignore config.properties,并添加一个config.properties-template,其中包含所有参数和注释,以解释如何在需要时填充它们。

Solved. 解决了。 What I did was to include a piece of code whick will create a config.properties file with default values if none are found. 我要做的是包含一段代码,如果找不到默认值,它将创建一个具有默认值的config.properties文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM