STS中pom.properties的目的是什么?

时间:2017-12-18 02:40:15

标签: spring git maven

enter image description here

嗨,我现在正在用STS和Git制作一个Spring项目。 但是,每当我尝试做Git Push时, 我发现我从未使用过的pom.properties文件总是会被自动修改。

1。 所以我总是忽略Git Stash clear或Git Reset。 这是一个聪明的行动吗?

2。 顺便问一下,pom.properties文件的目的是什么? 我试图在网上找到答案,但我不能。 Spring帮助指南也没有给我答案。

如果我能得到答案,我会很高兴。

1 个答案:

答案 0 :(得分:2)

As seen in "Version Informations Into Your Apps With Maven", this file would be used to show a version information in a kind of About Dialog or may be on command line as well.

That file is created by an archive step.

If you wanted to ignore it, you could do:

git rm --cached pom.properties
echo pom.properties>>.gitignore
git add .gitignore
git commit -m "Ignore pom.properties"
git push

That way, the file would still be generated/modified, but would no longer be tracked by your Git repository.

As commented by Ralph, the all target folder should not be in Git (since it can be rebuilt every time)

git rm -r --cached target
echo target/>>.gitginore
git add .gitignore
git commit -m "Ignore target folder"
git push