문제

I have a directory with my Maven projects in it. It looks like this:

.hg
.idea
parentProject
project1
   .idea
   docs
   src
   target   
   pom.xml 
project2
   .idea
   docs
   src
   target 
   pom.xml
target
pom.xml
.hgignore

I want to ignore the .idea and target directories in all my project. I have included the .idea and target directories into .hgignore but it only ignores those directories in the which .hgignore file is. This means that only in root directory .idea and target is ignored.

If I add .hgignore file in all sub projects this does not changes anything files are still not ignored.

My ignore list looks like this:

build
dist
target
faces-config.NavData
.idea
.iml

How should I specify in the .hgignore to get the .idea and target ignored from everywhere?

도움이 되었습니까?

해결책

try hgignore with regex

syntax: regexp
^\.idea$
^target$

다른 팁

How about something like **/.idea and **/target? Check out the possible patterns here.

You should not need to explicitly ignore target directory.

This problem will come if you have added it by mistake to Mercurial. Let's say you have done the following:

  1. Created a project and compiled a few times (hence target directory exist)
  2. Decided to add source control to the project so you've initialized a Mercurial repository and executed hg add command (either implicitly or explicitly from the IDE). Bam! You have now told Mercurial that target is a directory that should be included.

Trust me. I've been there !

To fix: Do the following from the command line:

hg forget target

When it comes to .idea directory I would think there's no other way than to use the .hgignore file but I'm puzzled why Intellij IDE doesn't add this automatically. (not a Intellij IDE user myself). That is the real question to ask.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top