Getting Started Bld - rife2/rife2 GitHub Wiki
Install bld
RIFE2's build tool bld
is fully self-contained in its own jar.
It's not required to install bld
because it can be launched by executing the
bld jar as such:
java -jar bld-1.9.1.jar
Alternatively, if you want to have bld
easily accessible from your shell,
you can also install it with Homebrew:
brew install rife2/tools/bld
Or with SDKMAN!:
sdk install bld
You can also download the bld-1.9.1.zip
archive from the
latest release and
change your environment so that the bin
directory is added to your PATH
.
Typing java -jar bld-1.9.1.jar
or bld
is interchangeable, they
take the same arguments. These instructions will focus on bld
for convenience.
Create your application
To create a new application with the package hello
and the name app
,
simply type:
bld create-rife2 hello app
Everything required to run and test your RIFE2 application was already
configured by bld
and the necessary jar files were automatically downloaded.
Change into your newly created application directory by typing:
cd app
Take a look at the build file
RIFE2's bld
fully leverages Java for your build process, you can read about it
in more detail in the dedicated bld
manual. For now,
please note that your build logic is located at src/bld/java/hello/AppBuild.java
.
A RIFE2 Hello World web application
The file src/main/java/hello/AppSite.java
contains code to help you get
started. The generated example is a little further along than the initial
steps of this tutorial. You'll catch up quickly, just keep reading.
As a starting point, below is the simplest possible RIFE2 Hello World
application, we'll build upon it to arrive at the code that bld
has generated
for you.
package hello;
import rife.engine.*;
public class AppSite extends Site {
public void setup() {
get("/hello", c -> c.print("Hello World"));
}
public static void main(String[] args) {
new Server().start(new AppSite());
}
}
NOTE: Feel free to replace
AppSite.java
with the example above to follow along, in case you want to be actively involved while this tutorial catches up.
Run it standalone
Compile the project and start the server:
./bld compile run
Visit your web application
Open http://localhost:8080/hello in your browser.
Next learn about Deployment