mardi 31 juillet 2018

Continuous integration for JAVA/Angular 5,6 project on Jenkins with maven and npm

To build a project Angular on Jenkins, you need to mix two technologies: NPM and maven.

To do so you need first to prepare you image that will host jenkins.

1 - install maven

Download maven and copy it into your /opt folder.

2 - install npm

yum install npm

3 - install node js

     curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
     apt-get install -y nodejs
     npm config set strict-ssl false



4- build your project

      echo Building Client application
      cd myapp-client
      npm install  @angular/core
      npm install --save-dev @angular/cli@6.1.1
      ./node_modules/.bin/ng update @angular/cli --migrate-only --from=1.7.4
      ./node_modules/.bin/ng build
      cd ..
      echo Successful completion of npm build
      echo Building Webapp
      cd myapp-webapp
      echo Build started on `date`
      mvn install
      echo Successful completion of webapp build