NS Initializer

Latest release: 1.4.0

The NS initializer is a command-line tool intended to set up new NS projects very quickly with all recommended defaults and a complete configuration for CI/CD.


Download

The easiest way to grab the ns-initializer is to download it from Nexus, or via Maven.

mvn dependency:copy "-Dartifact=net.democritus:ns-initializer:1.4.0:zip" "-DoutputDirectory=." "-Dmdep.stripClassifier=true"

This creates ns-initializer-1.4.0.zip in your current working directory.

Setup

The NS initializer comes packaged together with batch/shell scripts and all required dependencies. To set it up, extract the directory containing the distribution to the filesystem and add it to your PATH variable on Windows. On Linux create a link in /usr/bin to the nsinit script.

Parameters

For an overview, run nsinit -h.

  • -h, --help: Returns the help with an overview of all commands.
  • -V, --version: Returns the version of the ns-initializer.

Commands

Application project

Command: nsinit app

Creates a new NS application project. This can be imported into the PrimeRadiant after creation with the tool. Calling nsinit app in a directory will create a new project in this directory with the following content:

  • Application/ApplicationInstance model with the name of the root directory as their name.
  • Component model with dependencies on the base components and name example.
  • conf/expansionSettings.xml file with the expansion settings for the project, such as the nsx-default-stack expansion resource which contains all expanders needed to generate a JEE application.
  • pom-expansion.xml file to expand the project.
  • .gitignore file to ignore any known files that should not be committed to a Git repository.
  • .editorconfig file with some basic standard rules for formatting code in files.
  • README.md file to provide some basic information about the project.
  • CHANGELOG.md file to document changes to the project.
  • Jenkinsfile file with basic configuration to expand and build the project in Jenkins.
  • A local git repository with a first commit containing all generated files.

Parameters

For an overview, run nsinit app -h.

  • -h, --help: Returns the help with an overview of all commands.
  • -V, --version: Returns the version of the ns-initializer.
  • --app, --application: Used to specify a name for the application, rather than using the output directory name as the default.
  • --appinst, --application-instance: Used to specify a name for the application instance, rather than using the application name as the default.
  • --comp, --component: Used to specify the name for the main component of the application, instead of using example as a default.
  • --groupid: The groupId for the pom-expansion.xml Maven project file.
  • --no-base-components: Generate the project without any dependencies on the base components.
  • --no-jenkins: Do not generate a Jenkinsfile.
  • --no-git: Do not initialize a local git repository and do not generate a .gitignore file.
  • -o, --output: The directory where the project should be generated, rather than the current directory.
  • -y, --yes-to-all: Disables the interactive mode and accepts defaults for all settings that were not specified as arguments.
  • -f, --force: Forces the creation of the project, even when the output directory is not empty.

Example

nsinit app -y -o the-best-application --app bestApp --appinst bestAppInst --comp myAppComponent --groupid com.example

Resulting project:

the-best-application
│   .editorconfig
│   .gitignore
│   CHANGELOG.md
│   Jenkinsfile
│   pom-expansion.xml
│   README.md
│
├───.git
│
├───applications
│   └───bestApp
│       ├───model
│       │   │   bestApp-1.0.0.xml
│       │   │
│       │   └───instances
│       │           bestappinst.xml
│       │
│       └───settings
│           ├───businessLogicSettings
│           │       tomee_hsql_openjpa.xml
│           │       tomee_postgres_hibernate.xml
│           │
│           ├───globalOptionSettings
│           │       3_0_modern.xml
│           │
│           ├───presentationSettings
│           │       3_1_future.xml
│           │
│           └───technicalInfrastructure
│                   java_8.xml
│
├───components
│   └───myAppComponent
│       └───model
│               myAppComponent.xml
│
└───conf
        expansionSettings.xml

Expanders project

Command: nsinit expanders

Creates a new NS expanders project to create an expansion resource.

  • pom.xml Maven project file with the name of the output directory as the artifactId.
  • .gitignore file to ignore any known files that should not be committed to a Git repository.
  • .editorconfig file with some basic standard rules for formatting code in files.
  • README.md file to provide some basic information about the project.
  • CHANGELOG.md file to document changes to the project.
  • Jenkinsfile file with basic configuration to expand and build the project in Jenkins.
  • A local git repository with a first commit containing all generated files.

Parameters

For an overview, run nsinit expanders -h.

  • -h, --help: Returns the help with an overview of all commands.
  • -V, --version: Returns the version of the ns-initializer.
  • --groupid: The groupId for the pom.xml Maven project file.
  • --no-jenkins: Do not generate a Jenkinsfile.
  • --no-git: Do not initialize a local git repository and do not generate a .gitignore file.
  • -o, --output: The directory where the project should be generated, rather than the current directory.
  • -y, --yes-to-all: Disables the interactive mode and accepts defaults for all settings that were not specified as arguments.
  • -f, --force: Forces the creation of the project, even when the output directory is not empty.

Example

nsinit expanders -y -o my-new-expanders --groupid com.example

Resulting project:

my-new-expanders
│   .editorconfig
│   .gitignore
│   CHANGELOG.md
│   Jenkinsfile
│   pom.xml
│   README.md
│
├───.git
│
└───src
    ├───main
    │   ├───java
    │   └───resources
    └───test
        ├───java
        └───resources