Jakarta EE

The Jakarta EE Starter Project One-Liner That Works

Tired of complex Jakarta EE project setups? Discover the single Maven command-line that generates a complete, runnable starter project in seconds. No more boilerplate!

M

Marco Bianchi

A seasoned enterprise Java architect passionate about modern development and simplifying complex systems.

6 min read21 views

You’ve got a brilliant idea for a new web service. You’re fired up, your fingers are itching to write some code, and you open your favorite IDE. You’re ready to build the next big thing on the rock-solid foundation of Jakarta EE. And then… you hit the wall.

The wall of project setup. Which dependencies do I need? What’s the right Maven project structure? How do I configure the `pom.xml` for the Jakarta EE 10 platform? Do I still need a `web.xml`? Before you know it, an hour has passed, and you’ve written more XML than Java. The creative spark flickers.

In a world of `npx create-react-app` and `dotnet new`, the initial friction of starting a Jakarta EE project can feel a bit… dated. But what if I told you that you could bootstrap a complete, runnable, modern Jakarta EE project with a single command? No wizards, no manual file creation, just one line in your terminal.

Let's dive in.

The Magic Wand: Your One-Liner

Forget hunting for boilerplate. Open your terminal, navigate to your workspace, and paste this command. This is the one-liner that just works.

mvn archetype:generate \
    -DarchetypeGroupId=io.github.jakartaee-essentials \
    -DarchetypeArtifactId=jakartaee-essentials-archetype \
    -DarchetypeVersion=1.0.1 \
    -DgroupId=com.yourcompany \
    -DartifactId=my-awesome-app \
    -Dversion=1.0-SNAPSHOT \
    -DinteractiveMode=false

Hit enter. In a few seconds, Maven will work its magic, and you'll have a brand-new directory named `my-awesome-app` containing a fully configured Jakarta EE 10 project.

Decoding the Command

While copy-pasting is great, understanding what you’re running is even better. This command uses the standard Maven Archetype Plugin to generate a project from a template. Here’s a breakdown:

  • -DarchetypeGroupId, -DarchetypeArtifactId, -DarchetypeVersion: These three parameters point to the specific project template we want to use. In this case, it’s the excellent `jakartaee-essentials-archetype`, which provides a fantastic, lean starting point.
  • -DgroupId: This is your project's group ID, typically your organization's reversed domain name (e.g., `com.mycompany`, `org.myproject`).
  • -DartifactId: This is the name of your project artifact, which will also be the directory name (e.g., `user-service`, `inventory-manager`).
  • -Dversion: The initial version of your project. `1.0-SNAPSHOT` is a standard convention for a project in active development.
  • -DinteractiveMode=false: This is the secret sauce that makes it a true one-liner. Without this, Maven would prompt you to confirm each parameter. We're telling it to just get the job done.

Unboxing Your New Project

So, what did that command actually give you? `cd` into your new `my-awesome-app` directory and open it in your IDE. You’ll find a clean, conventional project structure.

The most important file is the `pom.xml`. Let’s look at its core:

Advertisement

    
        jakarta.platform
        jakarta.jakartaee-api
        10.0.0
        provided
    

This is the beauty of the Jakarta EE platform. Instead of managing dozens of individual API dependencies (JAX-RS, CDI, JPA, etc.), you include a single Bill of Materials (BOM) dependency. The `jakarta.jakartaee-api` artifact brings in all the APIs for the full platform. The `provided` scope tells Maven that these APIs will be supplied by the application server at runtime, so they don't need to be bundled into your final WAR file. This keeps your application artifact incredibly small and portable.

The archetype also scaffolds a few sample files to get you started:

  • `HelloResource.java`: A simple JAX-RS resource that defines a REST endpoint at `/api/hello`.
  • `HelloService.java`: A CDI bean injected into the `HelloResource`, demonstrating how easy dependency injection is.
  • `JAXRSConfiguration.java`: A standard JAX-RS application class that configures the root path for your API.

This isn't just an empty shell; it's a working, deployable microservice from the get-go.

From Zero to "Hello, World!" in 60 Seconds

A project that you can’t run is just a collection of files. Let's bring this one to life. The archetype comes pre-configured with the WildFly Maven Plugin, allowing you to run your app on a full-fledged application server without any manual installation.

Step 1: Build the project

Run the standard Maven command to compile your code and package it into a `.war` file.

mvn clean package

Step 2: Run the application

Now, start the WildFly server and deploy your application with a single command.

mvn wildfly:run

You'll see a flurry of logs as WildFly boots up and deploys `my-awesome-app.war`. Once you see a message indicating the deployment was successful, you're live!

Step 3: Test your endpoint

Open a new terminal and use `curl` (or your browser) to hit the sample endpoint created by the archetype.

curl http://localhost:8080/my-awesome-app/api/hello

You should see the response:

Hello, Jakarta EE!

That's it. From a single command to a running, testable Jakarta EE application in about a minute. Now you can get back to what matters: writing the business logic for your amazing idea.

Why This is My Go-To Method

There are other ways to start a project, like using your IDE's wizard or manually crafting a `pom.xml`. Here’s why I believe the archetype one-liner is superior for professional development.

Method Speed Consistency & Repeatability Learning Curve
Maven Archetype One-Liner Fastest Excellent. Perfect for CI/CD and team standards. Low. Just learn one command.
IDE Wizard (e.g., IntelliJ, Eclipse) Fast Good, but can vary between IDEs and versions. Lowest. Click-based, but hides details.
Manual Setup Slowest Poor. Prone to copy-paste errors and inconsistencies. High. Requires deep Maven/Jakarta EE knowledge.

A Quick Word on start.jakarta.ee

The official Jakarta EE Starter at start.jakarta.ee is another fantastic tool. It provides a web-based interface for customizing your project with specific Jakarta EE versions, runtimes (like WildFly, Open Liberty, etc.), and example code. It’s an excellent choice if you prefer a GUI.

However, the command-line one-liner shines for its sheer speed and scriptability. You can alias it, put it in a shell script for your team, or use it in automated tooling. It's the power-user's choice.

Stop Configuring, Start Creating

The barrier to entry for enterprise Java has never been lower. Modern tooling has stripped away the layers of ceremony that once defined the platform, leaving behind a lean, powerful, and productive development experience.

This one-liner isn't just a shortcut; it's a shift in mindset. It lets you move at the speed of your ideas, transforming creative sparks into running code before the friction of setup can extinguish them. So, bookmark this command, save it as a snippet, and the next time inspiration strikes, you'll be ready to build.

Now, go create something amazing.

Tags

You May Also Like