简体   繁体   中英

how to remove unwanted files from maven project

I am currently working with a spring web project. In my project, i am using git,maven and eclipse as IDE. when viewing git status in terminal these three files are present in all cases:

  • .classpath
  • .gitignore
  • .settings

how can in remove these unwanted files. i have no idea how these present in my project. my colleagues have also experiencing this issue.

any suggestions will be helpful.

As its a git repository, you can include below lines in your .gitignore file and then commit your .gitignore file to your central git repository, after that your local git repository won't show the ignore files which you added.

.settings
.classpath

Read more about .gitignore here https://help.github.com/articles/ignoring-files/ .

Edit :- You these files are already unchecked then you need to run below command ( If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, you must untrack the file first, by running the following command in your terminal :) :-

git rm --cached FILENAME

So in you case above command will look like git rm --cached .classpath and git rm --cached .settings .

Create .gitignore file in your project root directory and specify file path you want to untrack, for example:

.classpath
.project
.settings
target/
.mvn/

In SVN Repository can use Add to svn:ignore . using this one can remove unwanted files.

As other guys mentioned - you should add .gitignore file to the root of the project. There is a good Github project - gitignore . You could concat this files into one:

  1. Java.gitignore
  2. Maven.gitignore
  3. Eclipse.gitignore

You could read more about .gitignore in a project description

您可以直接打开工作区并打开项目,之后您可以手动删除这些文件...如果您使用的是Windows,请确保选中“显示隐藏文件”,删除之前请关闭eclipse然后删除文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM