This package has been deprecated

Author message:

This package was renamed to 'grunt-java-server'

grunt-servers

0.0.4 • Public • Published

grunt-servers

Download and connect on java-based web servers.

Build Status

Why?

It should be possible to integrate Java back-end and Javascript Front-end environments. I want to be able to run tests like grunt-contrib-qunit against a specific server that output its contents using Java JSTL API. Since there is no JS implementation of JSTL, it is impossible to reuse the same HTML used in Java development environment for Front-end only testing. So, if I want to test a specific component built using JSTL (for markup) and jQuery UI (for behavior) I have to replicate the HTML, which is not ideal.

How?

To solve this I need to create a generic task that serves as a hook to download, deploy, start and shutdown an external server that does not runs in node. Node would be used only for build.

What?

grunt-servers task acts as a hook to start an external server, without worrying about the back-end language your application uses.
This task has the same purpose of grunt-contrib-connect. The difference is that it uses java-based web servers instead of a node-based one.

Support

Want to contribute with another server? Check out the server configs file

Getting Started

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-servers --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks( "grunt-servers" );

Servers task

Run this task with the grunt servers command.

Note that this server only runs as long as grunt is running. Once grunt's tasks have completed, the web server stops. This behavior can be changed with the keepalive option.

This task was designed to be used in conjunction with another task that is run immediately afterwards, like the grunt-contrib-qunit plugin qunit task.

Options

preset

Type: String
Default: "wildfly-8.1.0.Final"

The server configs that is going to be used. By default, the task downloads the latest final Wildfly version.

directory

Type: String
Default: "target"

The target directory that should be used to store the downloaded and extracted server files.
By default it uses the target directory relative to the Gruntfile location.

args

Type: Array or Function
Default: []

An array of key-value pairs to be passed to the server upon startup as arguments.
If a function is passed, it is called with the first argument representing the server home directory.

keepalive

Type: Boolean
Default: false

Keep the server alive indefinitely. By default, once grunt's tasks have completed, the web server stops. This option changes that behavior.

Usage examples

Basic Use

grunt.initConfig({
  servers: {
    wildfly: {
      options: {
        args: [ "-b=192.168.100.10" ]
      }
    }
  }
});

Package Sidebar

Install

npm i grunt-servers

Weekly Downloads

2

Version

0.0.4

License

none

Last publish

Collaborators

  • fagner