Managing local files with Maven and SVN

I am looking for best practice for injecting local files into a project that is not tracked by the control source so that the version of the controlled source file is blind with changes.

In particular, I have a context file with database credentials. I want to save the source file "put your credentials here" into the source control, but I need this file to be populated with the appropriate credentials for my development installation (or production server or whatever you have) without pressing those credentials back to the original control. Obviously, I can just edit the file locally and not check it back. However, this becomes tedious over time, being careful that I do not accidentally check the credential file in the central code repository every time I need to check the change. An alternative approach would be to check a file like "-dist" that every user would need to rename and edit,to create a project at all.

I tried to take a look at Maven Overlays, as it looked as if I would need to create a whole separate project for my local credentials only using pom.xml and a war file. This seems like a lot of overhead for just a couple of files. What I actually have is a way to tell maven "if the X file (which is not in the source control at all) exists locally, use it. If not, use the Y file (which exists in the source control)." There seems to be a fairly automatic way to handle this.

+3
source share
4 answers

Is the Maven replacer plugin to solve your problems?

+2
source

Plain

, , , default.config, , local.default.config, svn.ignore. Maven local.default.config default.config, , , local.default.config, default.config, .

default.config , , home.dir - , .

, default.config , local.default.config - , .

Maven

Maven , :

profiles Maven . local, dev, qa release pom.xml. local , , mvn [goal] -P dev, local properties, dev.

SVN-

development , trunk . , , Git. SVN ,

, Maven. svn.ignore - . Maven profile .

+6

jasypt , Spring. Spring. .

- , , , .

+1
source

I think filtering can satisfy your needs. You may have a local.filter file that is not installed and a prod.filter file. You can use prod.filter by default and replace local.filter based on a command line flag or local profile that developers will have to use, but developers will not want to.

+1
source

All Articles