All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.docs.installation.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
{#==========================================
Docs : "installation"
==========================================#}

Installation

{#========================================== Section "installation / requirements" ==========================================#}

Requirements

  • A Java 8 JDK
  • A build tool able to use Maven artifacts.

{#========================================== Section "installation / versions" ==========================================#}

Spincast versions

Spincast ultimate goal is to follow the Java LTS (Long Term Support) versions.

The LTS is currently Java 11 but we believe the Java 9+ ecosystem is still wobbly because of the new modular system brought by Java 9 (called "JPMS" - Java Platform Module System - or "Jigsaw"). It is still hard to develop a Java 11 application using one of the three main IDEs, where annoying errors such as this one are still encountered.

For this reason, Spincast 1.X.X is still based on the very solid Java 8. Spincast 2.X.X will be based on Java 11, when we feel the tools are ready.

Finally, note that for the moment Spincast does not follow the Semantic Versioning. The major version is only incremented when a very important change is made (for example the Java version supported by Spincast changes). A minor version increment can contain a breaking change.

We may switch to a more semantic versioning friendly approach in the future if this is what developers using Spincast ask! But, for now, being able to include some breaking changes helps us improve Spincast very fast.

{#========================================== Section "installation / Quick Start" ==========================================#}

Quick Start application

{% if spincast.spincastCurrrentVersionIsSnapshot %} {% endif %}

The easiest way to try Spincast is to download the Quick Start application, which also can be used as a template to start a new application. This application already has in place most of the boilerplate code suggested to develop a solid and flexible Spincast application.

How to run :

  1. Download the Spincast Quick Start [.zip] application.
  2. Decompress the zip file, go inside the "spincast-quick-start" root directory using a command prompt and run :
    mvn clean package
    This will compile the application and produce an executable .jar file containing an embedded HTTP server.
  3. Start the application using :
    java -jar target/spincast-quickstart-1.0.0-SNAPSHOT.jar
  4. Once the application is running, open http://localhost:44419 in your browser!
  5. The next step would probably be to import the project in your favorite IDE and start debugging it to see how it works. The entry point of a standard Spincast application is the classic main(...) method. You'll find this method in class org.spincast.quickstart.App.

Note that the Quick Start application is not a simple "Hello World!" application. It contains some advanced (but recommended) features, such as a custom Request Context type and a custom WebSocket Context type! To learn Spincast from scratch, you may first want to read the three "Hello World!" tutorials before trying to understand the code of the Quick Start application.

{#========================================== Section "installation / Installing from scratch" ==========================================#}

Installing Spincast from scratch

{% if spincast.spincastCurrrentVersionIsSnapshot %} {% endif %}

If you want to start from scratch, without using the Quick Start application as a template, you first add the org.spincast:spincast-default:{{spincast.spincastCurrrentVersion}} artifact to your pom.xml :

<dependency>
    <groupId>org.spincast</groupId>
    <artifactId>spincast-default</artifactId>
    <version>{{spincast.spincastCurrrentVersion}}</version>
</dependency>

This artifact installs a set of default plugins and provides all the required components for a Spincast application to be functional.

{% if spincast.spincastCurrrentVersionIsSnapshot %}

Since this is a SNAPSHOT version, you also have to add this repository to your pom.xml (or build.gradle) :

<repositories>
    <repository>
        <id>sonatype-snapshots</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

{% endif %}

When this is done, you can follow the instructions of the Bootstrapping your app section to initialize your application. This process is very simple and simply requires you to use the Spincast.init(args) or Spincast.configure() bootstrapper in a main(...) method.

Here's a simple Spincast application :

public class App {

    public static void main(String[] args) {
        Spincast.init(args);
    }

    @Inject
    protected void init(DefaultRouter router, Server server) {
        router.GET("/").handle(context -> context.response().sendHtml("<h1>Hello World!</h1>"));
        server.start();
    }
}

There is a tutorial page for this simple "Hello World!" application. On that page you can download and try the application by yourself!





© 2015 - 2024 Weber Informatics LLC | Privacy Policy