java的gitignore文件示例

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29404850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 07:56:23  来源:igfitidea点击:

Example of gitignore file for java

javagitgitignore

提问by SaintGeorge

Can you show me example of .gitignorefile for java, that consider a lot of different files that are not included(jar, war, classpath, files that IDEA and other IDE generates and so on and on). I mean really big .gitignore.

您能否向我展示.gitignorejava 文件的示例,其中考虑了许多未包含的不同文件(jar、war、classpath、IDEA 和其他 IDE 生成的文件等等)。我的意思是真的很大.gitignore

What I currently have is

我目前拥有的是

**/target/
/target/
*/target/*
.classpath
.project
.settings

# Package Files #
*.jar
*.war
*.ear

*.iml
*.idea

采纳答案by Biswajit_86

You can get sample java gitignore files at https://github.com/github/gitignore/blob/master/Java.gitignore

您可以在https://github.com/github/gitignore/blob/master/Java.gitignore获取示例 java gitignore 文件

Based on the comments , here is a gist of the sample gitignore class

根据评论,这里是示例 gitignore 类的要点

*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

回答by Jaskey

check https://www.gitignore.io/.

检查https://www.gitignore.io/

If you want .gitignore file, pick up some from https://www.gitignore.io/api/java%2Cintellij

如果你想要 .gitignore 文件,请从https://www.gitignore.io/api/java%2Cintellij获取一些

回答by chimi

This .gitignore has other Java-related temp files added -

这个 .gitignore 添加了其他与 Java 相关的临时文件 -

https://gist.github.com/dedunumax/54e82214715e35439227

https://gist.github.com/dedunumax/54e82214715e35439227

##############################
## Java
##############################
.mtj.tmp/
*.class
*.jar
*.war
*.ear
*.nar
hs_err_pid*

##############################
## Maven
##############################
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
pom.xml.bak
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar

##############################
## Gradle
##############################
bin/
build/
.gradle
.gradletasknamecache
gradle-app.setting
!gradle-wrapper.jar

##############################
## IntelliJ
##############################
out/
.idea/
.idea_modules/
*.iml
*.ipr
*.iws

##############################
## Eclipse
##############################
.settings/
bin/
tmp/
.metadata
.classpath
.project
*.tmp
*.bak
*.swp
*~.nib
local.properties
.loadpath
.factorypath

##############################
## NetBeans
##############################
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml

##############################
## Visual Studio Code
##############################
.vscode/
.code-workspace

##############################
## OS X
##############################
.DS_Store