Build a JS application using Maven
When developing web applications with an abundance of JS, over time you come across the need to automate the assembly and testing, as well as the construction of various reports, documentation, etc. We encountered this problem almost immediately after the start of the project. Due to the fact that the server part is implemented in Java, the choice obviously fell on Maven. It remained to find a plugin that can work with javascript.
The searches were short lived and led to mojo.codehaus.org/javascript-maven-tools/ . “What you need,” I thought, and began to fasten it to the project.
To get started, configure maven to use plugins from the sandbox .
Create a project with the structure described on the plugin website. The pom.xml file can be taken from the example from the site.
Now, at the compilation phase, the plugin will merge the files specified in solution.jsb into one (or several) packages.
As usual, add (or change) a section in pom.xml
Now, at the stage of site generation (site goal), we will generate jsdoc, as well as a report on the correctness of the code (using JSLint). The result of JSLint is especially useful, since it allows you to eliminate flaws and errors in the code at an early stage (for example, an extra comma in the array is very sad for IE).
In order to assemble the project, it is enough to execute the command
To generate reports, you must run the command

Unfortunately, this plugin is really in alpha testing state. But this is not the worst. Worse, the plugin is no longer being developed. The last activity is dated to the beginning of the 9th year.
Due to the fact that this plugin is actively used in our project, we have prepared several patches and plan to offer them to the owner of javascript-maven-tools.
PS. Thank God, the license allows you to fork the project, so in case of a negative answer, we will definitely take advantage of the Apache License.
The searches were short lived and led to mojo.codehaus.org/javascript-maven-tools/ . “What you need,” I thought, and began to fasten it to the project.
Plugin connection
To get started, configure maven to use plugins from the sandbox .
Project preparation
Create a project with the structure described on the plugin website. The pom.xml file can be taken from the example from the site.
Build setup
Add the following section to pom.xml:
target/scripts
target/test-scripts
org.codehaus.mojo.javascript
javascript-maven-plugin
1.0-alpha-1-SNAPSHOT
true
${basedir}/src/main/assembler/solution.jsb
compile
* This source code was highlighted with Source Code Highlighter.
Now, at the compilation phase, the plugin will merge the files specified in solution.jsb into one (or several) packages.
Report Setup
As usual, add (or change) a section in pom.xml
org.codehaus.mojo.javascript
javascript-report-maven-plugin
1.0-alpha-1-SNAPSHOT
jsdoc
jslint
* This source code was highlighted with Source Code Highlighter.
Now, at the stage of site generation (site goal), we will generate jsdoc, as well as a report on the correctness of the code (using JSLint). The result of JSLint is especially useful, since it allows you to eliminate flaws and errors in the code at an early stage (for example, an extra comma in the array is very sad for IE).
Project assembly
In order to assemble the project, it is enough to execute the command
mvn compile
at the root of the project. After that, we target/scripts
will have a compiled application in the folder , ready to be downloaded to the site. To generate reports, you must run the command
mvn site
. Generated reports can be found in the foldertarget/site
A spoon of tar
Unfortunately, this plugin is really in alpha testing state. But this is not the worst. Worse, the plugin is no longer being developed. The last activity is dated to the beginning of the 9th year.
Barrel of honey
Due to the fact that this plugin is actively used in our project, we have prepared several patches and plan to offer them to the owner of javascript-maven-tools.
PS. Thank God, the license allows you to fork the project, so in case of a negative answer, we will definitely take advantage of the Apache License.