Getting Started

This page will help you create and build your first SeedStack application.

Using the generator

Using the SeedStack generator is the easiest way to start building a new SeedStack application. It allows you to select the type of project you want to create and, by answering a few questions, generate a fully operational application.

Assuming that you have Maven installed, run the following command:

mvn -U org.seedstack:seedstack-maven-plugin:generate

Choose the web project type. Then just press enter each time the generator asks a question. It will use the default values.

For more information about project generation, please read this guide

Run the application

To run the Web application, use the watch goal. It will watch source folders and when something change trigger a recompile and an application refresh. Run the following command:

mvn seedstack:watch

Then, in your favorite browser, go to http://localhost:8080/hello. It should display the «Hello World!» string.

You can terminate the application gracefully with Ctrl+C.

The watch goal supports the LiveReload protocol to automatically reload the browser page when the application change. You must install and activate a LiveReload extension for you browser to make it work.

You can also run the application without hot-reloading with the run goal.

Modify the application

Now that you have successfully run the application, let’s modify it. The «Hello World!» text is generated by a REST resource located in the HelloResource.java file:

  • Change the text returned by the hello() method to something else.
  • Save the file.
  • The application should be refreshed.
  • If you enabled the LiveReload extension (see above), the browser page should refresh automatically.

That’s it!

Congratulations! You’ve just successfully run and modified your first SeedStack application.

Dependency management

SeedStack comes with full dependency-management so you never have to specify individual component version.

This is done with a Maven BOM imported in the POM of the project:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.seedstack</groupId>
            <artifactId>seedstack-bom</artifactId>
            <version>21.11</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Packaging

You can package the application with the following command:

mvn clean package

SeedStack automatically packages the application in a one-JAR capsule. After the build, this capsule is located into the target directory.

It is a self-executable JAR you can run with the following command:

java -jar target/my-web-project-capsule.jar

Learn more about application packaging by reading about the Maven package goal.

Java IDE

If you want to use a Java IDE, just import the generated project as you would do with any Maven project.

To run the application directly from the IDE, create a «Run configuration» for a standalone Java application, and specify the org.seedstack.seed.core.SeedMain main class.

Now what ?

On this page you have learned:

  • How to create a SeedStack project from scratch using the generator.
  • How to run the project in hot-reloading mode.

Troubleshooting

If you can’t get this to work, check the troubleshooting page.

Next step

If you want to learn more, continue on the tutorial to learn the basics.

   

On this page


Edit