.groovy

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.

Category
Code and data
MIME type
Type
Plain text
Is a .groovy file safe to open? Caution. A .groovy file is a script that runs on the JVM. Review unfamiliar scripts, especially build or pipeline files, before running them.

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.

What opens 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.

Windows

  • IntelliJ IDEA
  • VS Code
  • any text editor

macOS

  • IntelliJ IDEA
  • VS Code
  • any text editor

Linux

  • IntelliJ IDEA
  • VS Code
  • any text editor

Open a .groovy file step by step

  1. Confirm the file really is a .groovy. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with IntelliJ IDEA or VS Code.
  3. On Mac, use IntelliJ IDEA or VS Code.
  4. On Linux, try IntelliJ IDEA or VS Code.
  5. Still stuck? Search for a dedicated Groovy viewer rather than a generic one.

Why can't I open my .groovy file?

Almost always because no installed app understands Groovy. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .groovy at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

Groovy has no fixed magic number, so there is no signature table on this page. Its bytes alone do not prove the format: identification relies on the extension, the structure of the content and the program that created it. The magic-numbers reference lists the formats that do carry one.

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. How sources are ranked and what is deliberately left out is set out in the methodology.