What is a .groovy file?
Apache Groovy Source File · Code and data · Apache Software Foundation · 2003
A .groovy file is Apache Groovy source code, a dynamic language for the Java Virtual Machine. It reads like a simplified Java and is widely used for scripting, testing and Gradle and Jenkins build automation.
What is a .groovy file used for?
Groovy runs on the JVM and works seamlessly with Java, but adds concise syntax and dynamic features. It is the default language of Gradle build scripts and Jenkins pipelines, so many .groovy files are automation rather than applications.
The files are plain text; IntelliJ IDEA and VS Code handle them well.
How to open a .groovy file
The .groovy format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .groovy file.
Windows
- IntelliJ IDEA
- VS Code
- any text editor
macOS
- IntelliJ IDEA
- VS Code
- any text editor
Linux
- IntelliJ IDEA
- VS Code
- any text editor
.groovy file signature (magic bytes)
Programs recognise a .groovy file by the bytes at the start of the file, not by its name. These are the signatures for Groovy.
| Hex signature | Offset | Note |
|---|---|---|
| (no fixed signature) | 0 | plain text; no fixed magic bytes |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .groovy file?
A .groovy file is Apache Groovy source code, a dynamic language for the Java Virtual Machine. It reads like a simplified Java and is widely used for scripting, testing and Gradle and Jenkins build automation.
How do I run a .groovy file?
With Groovy installed, run groovy file.groovy. Gradle and Jenkins run their own .groovy build and pipeline scripts automatically.
Is Groovy the same as Java?
No, but it runs on the same JVM and can use Java libraries. Groovy adds dynamic typing and terser syntax, and most Java code is also valid Groovy.
Why do build tools use .groovy files?
Gradle build scripts and Jenkins pipelines are written in Groovy because its concise, flexible syntax suits describing build and automation logic.
Related formats
Sources
Details on this page were checked against authoritative references: