DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Containerize Gradle Apps and Deploy to Kubernetes With JKube Kubernetes Gradle Plugin
  • Hello World Groovy in the Cloud With Spring
  • Groovify Your Java Servlets (Part 2): Scripting the JVM
  • Integrating Java and npm Builds Using Gradle - Groovy or Kotlin DSL

Trending

  • Beyond the Prompt: Unmasking Prompt Injections in Large Language Models
  • The Emergence of Cloud-Native Integration Patterns in Modern Enterprises
  • Microservices With Apache Camel and Quarkus
  • Development of Custom Web Applications Within SAP Business Technology Platform
  1. DZone
  2. Coding
  3. Languages
  4. How to Create Modular Groovy Applications in 5 Steps!

How to Create Modular Groovy Applications in 5 Steps!

Geertjan Wielenga user avatar by
Geertjan Wielenga
·
Feb. 14, 09 · News
Like (0)
Save
Tweet
Share
20.88K Views

Join the DZone community and get the full member experience.

Join For Free

let's create a modular groovy application! why?! modularity is an enabler of scaleability. as your groovy application increases in size, you increasingly need to manage code dependencies, structure your code in units that are larger than packages, and distribute pieces of your application to developers located in different locations and conflicting time zones. welcome to modularity.

the netbeans platform already provides it (plus, osgi is coming to the netbeans platform ). beyond modularity, there are specific features that the netbeans platform provides that will remain unique, such as a shared filesystem for intermodular communication and the concept of "context" (i.e., netbeans lookup), which not only applications have (as with the jdk 6 serviceloader class), but netbeans platform objects such as windows themselves. welcome to loosely coupled modularity.

now, let's get started.

  1. start up netbeans ide 6.5.

  2. go to this page and download the groovy console template and use the plugin manager (in the tools menu) to install it into the ide.

  3. now, in the new project dialog, you should see this new project template:

  4. click next, give your new application a name (such as "helloworld") and a location on disk, and then click finish. expand a few folders and you should now see this:

    briefly, the template gives you a groovy pojo, with this content:

    package org.my.app

    public class demopojo {

    def foo

    }

    the template also gives you a moduleinstall class, which handles the lifecycle of the module:

    package org.my.app

    import org.openide.modules.moduleinstall as mi

    public class installer extends mi {

    @override
    public void restored() {

    for(int i = 0; i < 10; i++) {
    demopojo dp = new demopojo()
    dp.setfoo(i)
    println("number: " + dp.getfoo())
    }

    }

    }

    so, we have some standard groovy constructs here, simply to get you started in the ecosystem of the netbeans platform. the module also includes a properties file for internationalization purposes and a layer.xml file, for the module's contributions to the shared filesystem.

  5. run the application (i.e., without doing anything at all, no tweaking, no post processing, nothing at all, just run it). look in the output window of netbeans ide and you will see this:

so, you can see that you only have the absolute minimum set of modules to start with. also you're using the groovy compiler (thanks to an additional target that's added to the demo module's build.xml file). that's how to get started with modular groovy applications. have fun with groovy on the netbeans platform!

application Groovy (programming language)

Opinions expressed by DZone contributors are their own.

Related

  • Containerize Gradle Apps and Deploy to Kubernetes With JKube Kubernetes Gradle Plugin
  • Hello World Groovy in the Cloud With Spring
  • Groovify Your Java Servlets (Part 2): Scripting the JVM
  • Integrating Java and npm Builds Using Gradle - Groovy or Kotlin DSL

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: