gitignore file for Gradle java and android project

Gradle is a Java project build tool that allows you to compile, build, manage dependencies, and deploy your projects. It also creates jar/war/ear files for various web and Android applications.

The java Gradle project includes XML, java, and JSP source code that commits to svn and git repositories.

Gitignore is a file that includes a list of files or directories that ignores when committing to remote repositories in Java projects.

What files in java Gradle projects skip for git commits?

The files generated during the Gradle build process are listed below and added to the .gitignore file.

Gradle compiles java files and generates class files in the target folder.so These files add to gitignore.

*.class

The archive files created by the final application are in the jar, ear, and war formats. The following entries add to the gitignore file for package-related files.

*.jar
*.war
*.ear

.gitignore file for eclipse gradle projects

when java projects opened in IDE’s like eclipse, Intelli, and BlueJ, It generated IDE-specific related temporary as well as environment files

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

gitignore file for Intelli IDEA editor for Gradle projects

The Gradle projects are loaded and configured differently in each IDE. Intelli IDE generates several temporary files and adds them to the gitignore file in Gradle applications.

Here is the git ignore file example for Intelli IDEA

# generated files
bin/**
gen/**
# project based files
.idea/
*.iml
*.ipr
*.iws
.gradletasknamecache
.gradle/
build/
bin/

gitignore file for Netbeans in Gradle applications:

Netbeans output a lot for temporary files and folders when you imported Gradle projects.

/*/nb-configuration.xml
/nbproject/
/*/nbproject/
/*/target/
/*/build/
/netbeans-gradle-default-models/gradle-api/
.gradle/
/.nb-gradle-properties
.nb-gradle/

gitignore file example for Gradle java application

*.class
*.jar
*.war
*.ear
# generated files
bin/**
gen/**
# project based files
.idea/
*.iml
*.ipr
*.iws
.gradletasknamecache
.gradle/
build/
bin/