Git Product home page Git Product logo

ems-springboot's Introduction

Jenkins

Configure Maven to bundle all dependencies in a single file and copy to a desired folder

  1. Open pom.xml in your repository and put this in your properties field
<output.dir>${env.HOME}/Documents</output.dir>

In this example, we are storing the jar in ~/Documents

  1. In plugins field add this
<plugin>
   <artifactId>maven-assembly-plugin</artifactId>
   <version>3.1.1</version>
   <configuration>
      <descriptorRefs>
         <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
      <archive>
         <manifest>
            <addClasspath>true</addClasspath>
            <classpathPrefix>lib/</classpathPrefix>
            <mainClass>com.ems.springboot.Main</mainClass> <!--Here goes your main class-->
         </manifest>
      </archive>
      <outputDirectory>${output.dir}</outputDirectory>
   </configuration>
   <executions>
      <execution>
         <id>make-assembly</id>
         <phase>package</phase>
         <goals>
            <goal>single</goal>
         </goals>
      </execution>
   </executions>
</plugin>
  1. To bundle everything run mvn clean package -DskipTests

Installing and Configuring Jenkins

  1. Open terminal and type the following code to download jenkins.war in your home directory.
sudo curl --progress-bar -O -L http://mirrors.jenkins.io/war-stable/latest/jenkins.war
  1. Run java -jar jenkins.war --httpPort=8080.
  2. Browse to http://localhost:8080.
  3. Follow the instructions to complete the installation.

NOTE: No need to create admin account. In case you forget your password, it is stored in ~/.jekins/secrets/initialAdminPassword

  1. In your terminal, cd to your repository and type
echo "pipeline {
    agent any
    stages {
        stage('Clone') {
            steps {
                git branch: 'master', url: https://github.com/ashvinsharma/ems-springboot.git
            }
        }

        stage('Build') {
            steps {
                sh 'mvn --version'
                sh 'mvn clean package -DskipTests'
            }
        }
    }
}" > Jenkinsfile
  1. In your browser, open Jenkins and click on New Item.

  2. Type name for your project and choose pipeline from the list.

  3. Select Pipeline tab.

    1. Definition: Pipeline from SCM
    2. SCM: Git
      1. Repository URL:
      2. Credentials:
    3. Script Path: Jenkinsfile
  4. Hit Save and Apply.

  5. To check if everything is working click Build Now.

ems-springboot's People

Contributors

ashvinsharma avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.