Jenkins

Continuous Integration and Delivery https://jenkins.io/doc/ https://jenkins.io/doc/book/appendix/advanced-installation/

Install version jenkins 2.9.1 LTS

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

*************************************

This may also be found at: /home/vitor/.jenkins/secrets/initialAdminPassword
http://localhost:8081/jenkins

Use git repository

# create project on git server
cd /home/git
mkdir helloJenkins.git
cd helloJenkins.git
git --bare init
git config core.sharedRepository group
cd /home/git
chown git * -R
chgrp git * -R

#create project on local machine
cd ~/Documents
mkdir helloJenkins
cd helloJenkins
git init
touch README
git add .
git commit -m 'Initial commit'
git config --list #check config
git remote remove origin
git remote add origin ssh://git@example.org:1234/home/git/helloJenkins.git
git push origin master
git log

Jenkins job jobx

git repository: ssh://git@example.org:1234/home/git/helloJenkins.git
credentials: none
branch to build: master
build: invoke top level maven targets, goals clean install
build triggers: poll scm every minute
*/1 * * * *  
save 

Test project to build in Jenkins

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
        http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>artifactX</artifactId>
    <packaging>jar</packaging>
    <version>0.0.1</version>
    <name>artifactX</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.example.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> 
                        <phase>package</phase> 
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
    </dependencies>
    <!-- archiva repositories -->
    <distributionManagement>
        <repository>
          <id>archiva.internal</id>
          <name>Internal Release Repository</name>
          <url>http://localhost:8082/repository/internal/</url>
        </repository>
        <snapshotRepository>
          <id>archiva.snapshots</id>
          <name>Internal Snapshot Repository</name>
          <url>http://localhost:8082/repository/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>    
    
</project>

package com.example;

public class Main{
    public static void Main(String[] args ){
        System.out.println("Version 0.0.1-SNAPSHOT");
    }
}

Jenkins (last edited 2016-10-09 17:02:24 by localhost)