Search code examples
gitjenkinsgitignore

How to configure Jenkins pass over git ignore files?


I am deploying jenkins with Git.

Almost process are fine, but can't build if project has .gitIgnore file.

Maven compiler can't recognize files that described on git ignore file.

But I need git ignore files because I should hide DB connection info and My authentication info on GitHub.

How can I config that?


Solution

  • If you are using spring framework, all of your concerns are solved.

    Spring allows you to use:

    • local properties
    • properties file from others jars
    • properties file located in any directory of operative system

    If you like to code, you can write your own PropertyPlaceholderConfigurer to read your properties file from where you want, for example from database :

    https://www.opencodez.com/java/how-to-load-application-properties-from-database.htm

    Also you can check this link to analyze others approaches to externalize your properties file, not only for java frameworks:

    https://stackoverflow.com/a/51268633/3957754