Maven archetype to create a groovy project

I am looking to create a maven groovy project using some sort of maven archetype. Typically in Java project the directories generated are:

  • src/main/java
  • src/main/resources
  • src/test/java
  • src/test/resources

Is there a maven archetype that can generate a convention project by similar conventions, perhaps that has src/main/groovy and src/test/groovy? Something that IDEs such as IntelliJ may auto-detect as a groovy project.


Have you tried with one of the available here? https://mvnrepository.com/artifact/org.codehaus.groovy.maven.archetypes

For instance by running:

mvn archetype:generate -DarchetypeGroupId=org.codehaus.groovy.maven.archetypes -DarchetypeArtifactId=gmaven-archetype-basic -DarchetypeVersion=1.0

after running mvn archetype:generate add the lines below to the pom.xml file to set java version to 8 or higher.

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.java.version>8</project.java.version>
        <project.javabin.version>8</project.javabin.version>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

You can also see the following post: https://www.baeldung.com/groovy-java-applications.