Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven archetype to create a groovy project

Tags:

maven

groovy

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.

like image 594
sshekhar1980 Avatar asked Jan 26 '26 19:01

sshekhar1980


1 Answers

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.

like image 128
Borja Bodoque Avatar answered Jan 29 '26 12:01

Borja Bodoque



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!