Deploy a NodeJs (FrontEnd) and a Spring (BackEnd) project as one artefact

continuous integrationJenkinsmavennode.js

I have a current project which consist out of two independently developed projects:

  • Spring REST as back end
  • Angular as front end

I do have a Jenkins instance available for building my projects and I'd would like to "marry" both of the projects in a CD job to a single deployable file (.jar)

Is this a job of jenkins, to copy all needed files together? Or is this usually solved with a maven plugin? I couldn't find much information about that, although it seems like a very common step to me.

Best Answer

Ant or Maven are usually used for this. For example, Apache Wicket calls npm and Grunt from within the pom.xml:

<artifactId>wicket-js-tests</artifactId>
<packaging>jar</packaging>
<name>Wicket JavaScript Tests</name>
<description>JavaScript tests for all Wicket modules</description>


<execution>
  <id>install node and npm</id>
  <goals>
    <goal>install-node-and-npm</goal>
  </goals>
  <phase>generate-resources</phase>
  <configuration>
    <npmVersion>5.6.0</npmVersion>
    <nodeVersion>v8.9.0</nodeVersion>
  </configuration>
</execution>

<execution>
  <id>npm install</id>
  <goals>
    <goal>npm</goal>
  </goals>
  <configuration>
    <arguments>install</arguments>
  </configuration>
</execution>

<execution>
  <id>grunt build</id>
  <goals>
    <goal>grunt</goal>
  </goals>
  <configuration>
    <!--<arguments> - -verbose </arguments>-->
  </configuration>
</execution>

And Apache Freemarker Docgen calls npm and Gulp from within build.xml:

  <!-- See README.md about installing node.js and Gulp! -->
  <target name="node-deps">
    <exec executable="npm" dir="${basedir}" failonerror="true" osfamily="unix">
      <arg line="install" />
    </exec>
    <exec executable="cmd" dir="${basedir}" failonerror="true" osfamily="windows">
        <arg line="/c npm install" />
    </exec>
  </target>

  <target name="gulp">
    <exec executable="node" failonerror="true" dir="${basedir}">
      <arg line="node_modules/gulp/bin/gulp.js"/>
    </exec>

    <!--
    <exec executable="${nodeJsCommand}" failonerror="true" dir="${basedir}">
      <arg value="node_modules/gulp/bin/gulp.js"/>
    </exec>
  -->
  </target>

References