-
Notifications
You must be signed in to change notification settings - Fork 13
Standard Commands
With the newly created project as your current
directory, you can get its list of commands by using the project's bld
instead of the global one:
./bld
You'll see a similar output as you saw in the installation section, but this time only the commands that your project supports are listed:
Welcome to bld 2.1.0.
The bld CLI provides its features through a series of commands that
perform specific tasks.
The following commands are supported:
clean Cleans the build files
compile Compiles the project
dependency-tree Outputs the dependency tree of the project
download Downloads all dependencies of the project
help Provides help about any of the other commands
jar Creates a jar archive for the project
jar-javadoc Creates a javadoc jar archive for the project
jar-sources Creates a sources jar archive for the project
javadoc Generates javadoc for the project
precompile Pre-compiles RIFE2 templates to class files
publish Publishes the artifacts of your web project
publish-local Publishes to the local maven repository
purge Purges all unused artifacts from the project
run Runs the project (take option)
test Tests the project with JUnit (takes options)
uberjar Creates an UberJar archive for the project
updates Checks for updates of the project dependencies
version Outputs the version of the build system
war Creates a war archive for the project
The following bld arguments are supported:
--offline Works without Internet (only as first argument)
-?, -h, --help Shows the help
-D<name>=<value> Sets a JVM system property
-s, --stacktrace Prints out the stacktrace for exceptions
NOTE: As your project's build logic evolves, it's entirely possible that more commands get added, or that existing commands get changed.
TIP:
bld
searches for an existing command when there's no exact match, meaning thatbld updates
could bebld update
, or evenbld ud
, orbld download purge
could bebld do pur
. As long as there's no ambiguity about which command to use, it will be executed.
To compile the project and run it, simply type:
./bld compile run
Now visit http://localhost:8080 in your browser to see the application running.
Press control+c
to quit the running application.
bld
automatically figures out the classpath entries necessary for the
compilation of your sources. Note that this simply happens by putting jar files
in the relevant lib
directories. If you don't want to use the dependency
system, this is an easy way to set up a local project with files you already
have.
TIP: If you're developing a RIFE2 project, you can freely edit the main resources while the application is running, the IDE projects and bld are set up in such a way that RIFE2's auto-reloading features work out of the box.
If you've used any other build tool before, clean does exactly what it says, it cleans all the files that were generated by the build system.
This is very useful if you want to be absolutely sure that no older lingering files are present, which is probably what you want when you create an archive for distribution.
This outputs the full dependency tree of all the extension and the dependency scopes, making it easy to understand why certain jar files might be pulled in.
Downloads all the files that are part of your project's dependencies. Any files that were already downloaded and that are identical, will not be downloaded again. This is an easy way to get new files when you update your dependencies.
NOTE: If you're fine with
bld
automatically managing your dependency downloads, similarly to other build tools like Maven or Gradle, you can set theautoDownloadPurge
option in your project totrue
.
Outputs the main help, but can also provide additional help about any of the other commands, for instance:
./bld help test
Welcome to bld 2.1.0.
Tests the project with JUnit.
Additional JUnit console launcher options can be
provided after the command.
These commandline options are provided by this command:
--junit-help see the full list of JUnit launcher options
--junit-clear clear the JUnit launcher options the build uses
(needs to be provided before other options)
Usage : test [OPTIONS]
This commands creates a jar archive of the compiled classes from your main source files. When the command finishes, it lets you know where the archive is that was created:
The jar archive was created at '/Users/youruser/myapp/build/dist/myapp-0.1.0.jar'
This commands creates a javadoc archive of your main source files. When the command finishes, it lets you know where the archive is that was created:
The jar archive was created at '/Users/youruser/myapp/build/dist/myapp-0.1.0-javadoc.jar'
This commands creates an archive of your main source files. When the command finishes, it lets you know where the archive is that was created:
The jar archive was created at '/Users/youruser/myapp/build/dist/myapp-0.1.0-sources.jar'
The command generates javadoc for the main source files of your project.
RIFE2's templates can be precompiled to Java classes for production deployment.
This command looks at the templates in your main resources
and precompiles
the types that were added to the precompiledTemplateTypes
of your project.
Builds the 'jar' artifact of a project, and also the 'uberjar' and 'war' artifacts of a web project, publishing them to a Maven-compatible repository when successful.
In order for publishing to succeed, you need to set the publishRepository
.
Some information can be inferred by bld
, though it's recommended to configure
the publishing metadata by also setting publishInfo
in your project.
Performs the exact same logic as the publish
command, but replaces all the
public repositories with your local maven repository.
Resolves all the dependencies in your project and deletes the lib
files that
don't correspond. Using download purge
as commands in succession, is a
convenient way to update all your libraries to your latest dependency versions
and to have nothing lingering in your classpath.
Runs the tests that are available in your project.
The blank and RIFE2 projects use JUnit 5 and its execution tool by default, the base project uses your main file in the test sources as the tool. This behavior can be changed by customizing your project.
Don't forget to compile your sources before running the tests, or the execution will fail.
The blank and RIFE2 projects JUnit 5 command has a default configuration set
that can be customized either in your build project, or through the commandline.
The JUnitOptions
javadocs provide information on how to change your build, and typing
./bld help test
will give you additional command line information:
./bld help test
Welcome to bld 2.1.0.
Tests the project with JUnit.
Additional JUnit console launcher options can be
provided after the command.
These commandline options are provided by this command:
--junit-help see the full list of JUnit launcher options
--junit-clear clear the JUnit launcher options the build uses
(needs to be provided before other options)
Usage : test [OPTIONS]
If you for instance only want to test a particular package, you could type:
./bld test --select-package=package.to.test
An UberJar contains all the classes required to run your application, even those of your dependencies. When the command finishes, it lets you know where the archive is that was created:
The uberjar archive was created at '/Users/youruser/myapp/build/dist/myapp-0.1.0-uber.jar'
To launch the application with the UberJar, simply type:
java -jar myapp-0.1.0-uber.jar
Resolves all your dependencies and checks if newer version are available. This command doesn't make any changes to your build files but simply lists what is available, for example:
The following dependency updates were found.
compile:
com.uwyn.rife2:rife2:1.7.0
standalone:
org.eclipse.jetty:jetty-server:11.0.15
org.slf4j:slf4j-simple:2.0.7
If you want to change your dependencies to newer versions, manually update
the build files and use bld
to download
and purge
.
Outputs the version of bld
that you're using.
Creates a war archive that can be deployed in a Java servlet container. The structure of your project dictates how the files in your war archive are organized. When the command finishes, it lets you know where the archive is that was created:
The war archive was created at '/Users/youruser/myapp/build/dist/myapp-0.1.0.war'
Next learn more about Custom Bld Commands