.hgignore file is not ignoring the maven target/site directory

谁都会走 提交于 2019-12-13 17:34:17

问题


I've created a basic maven/mercurial setup. I've created a .hgignore in the working directory. I have added the following to the .hgignore file (as per the instructions in https://www.mercurial-scm.org/wiki/.hgignore

/target$
/.DS_Store$
.DS_Store$

I had run hg status and everything was ignored (as expected)

I ran mvn site. Now, when I run the hg status command, everything but the site folder is being ignored in the target folder... e.g.

~/dev/blah >hg st  

? target/site/css/maven-base.css
? target/site/css/maven-theme.css
? target/site/css/print.css
...

nb: as stated earlier, the other files in the target folder (.class, .xml, etc...) HAVE been ignored...

The target/site folder has not been added to the repository (as far as I can tell...)

anyone know where I'm going wrong...?

update: z3a inspired me to try ^target/*$ and that appears to have done the trick...


回答1:


If you want to ignore the target dir, but not the target/site in your .hgignore put something like this:

syntax: regexp
^target/(?!site)


来源:https://stackoverflow.com/questions/5202927/hgignore-file-is-not-ignoring-the-maven-target-site-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!