Skip to content

Commit 465d9ff

Browse files
committed
initial commit with maven, artifcatory and jenkins
1 parent 659b4f0 commit 465d9ff

File tree

10 files changed

+237
-0
lines changed

10 files changed

+237
-0
lines changed

Setup_Artifactory.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Setup Jfrog Artifactory
2+
3+
## Pre-requisites:
4+
1. Setup an AWS T2.Small EC2 instance
5+
6+
## Installation Steps
7+
8+
1. Install Java
9+
```sh
10+
yum install java-1.8* -y
11+
```
12+
1. Download Artifaction packages from
13+
14+
```sh
15+
wget https://bintray.com/jfrog/artifactory-pro/download_file?file_path=org%2Fartifactory%2Fpro%2Fjfrog-artifactory-pro%2F6.19.1%2Fjfrog-artifactory-pro-6.19.1.zip
16+
```
17+
18+
1. extract artifactory zip file
19+
```sh
20+
unzip download_file?file_path=org%2Fartifactory%2Fpro%2Fjfrog-artifactory-pro%2F6.19.1%2Fjfrog-artifactory-pro-6.19.1.zip
21+
```
22+
1. start artifactory services
23+
```sh
24+
cd artifactory-pro-6.19.1/bin
25+
./artifactory.sh start
26+
```
27+
1. access artifactory from browser
28+
```sh
29+
http://<IP_Address>:8081
30+
```
31+
32+
1. Provide credentials
33+
```sh
34+
username: admin
35+
password: passwrod
36+
```
37+

jenkins/DSL_jobs/1job.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
job('job_dsl_example') {
3+
4+
}
5+

jenkins/DSL_jobs/2description.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
job('job_dsl_example') {
3+
4+
description('This is my awesome Job')
5+
}

jenkins/DSL_jobs/3parameters.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
job('job_dsl_example') {
3+
4+
description('This is my awesome Job')
5+
6+
7+
parameters {
8+
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
9+
booleanParam('FLAG', true)
10+
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
11+
}
12+
13+
}
14+

jenkins/DSL_jobs/4scm.j2

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
job('job_dsl_example') {
3+
4+
description('This is my awesome Job')
5+
6+
7+
parameters {
8+
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
9+
booleanParam('FLAG', true)
10+
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
11+
}
12+
13+
14+
scm {
15+
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
16+
}
17+
18+
}
19+

jenkins/DSL_jobs/5triggers.j2

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
job('job_dsl_example') {
3+
4+
description('This is my awesome Job')
5+
6+
7+
parameters {
8+
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
9+
booleanParam('FLAG', true)
10+
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
11+
}
12+
13+
scm {
14+
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
15+
}
16+
17+
triggers {
18+
cron('H 5 * * 7')
19+
}
20+
21+
}
22+

jenkins/DSL_jobs/6steps.j2

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
job('job_dsl_example') {
3+
4+
description('This is my awesome Job')
5+
6+
7+
parameters {
8+
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
9+
booleanParam('FLAG', true)
10+
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
11+
}
12+
13+
scm {
14+
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
15+
}
16+
17+
triggers {
18+
cron('H 5 * * 7')
19+
}
20+
21+
steps {
22+
shell("echo 'Hello World'")
23+
}
24+
}
25+

jenkins/DSL_jobs/7mailer.j2

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
job('job_dsl_example') {
3+
4+
description('This is my awesome Job')
5+
6+
7+
parameters {
8+
stringParam('Planet', defaultValue = 'world', description = 'This is the world')
9+
booleanParam('FLAG', true)
10+
choiceParam('OPTION', ['option 1 (default)', 'option 2', 'option 3'])
11+
}
12+
13+
scm {
14+
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master')
15+
}
16+
17+
triggers {
18+
cron('H 5 * * 7')
19+
}
20+
21+
steps {
22+
shell("echo 'Hello World'")
23+
shell("echo 'Hello World2'")
24+
}
25+
26+
publishers {
27+
mailer('[email protected]', true, true)
28+
}
29+
}
30+

jenkins/DSL_jobs/8maven.j2

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
job('maven_dsl') {
2+
3+
description('Maven dsl project')
4+
5+
scm {
6+
git('https://github.com/jenkins-docs/simple-java-maven-app', 'master', {node -> node / 'extensions' << '' })
7+
}
8+
9+
steps {
10+
maven {
11+
mavenInstallation('maven')
12+
goals('-B -DskipTests clean package')
13+
}
14+
maven {
15+
mavenInstallation('maven')
16+
goals('test')
17+
}
18+
shell('''
19+
echo ************RUNNING THE JAR************************
20+
java -jar /var/lib/jenkins/workspace/maven_dsl/target/my-app-1.0-SNAPSHOT.jar
21+
''')
22+
}
23+
24+
publishers {
25+
archiveArtifacts('target/*.jar')
26+
archiveJunit('target/surefire-reports/*.xml')
27+
mailer('[email protected]', true, true)
28+
}
29+
}
30+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# How to deploy on tomcat server using maven
2+
Pre-requisites
3+
1. Maven Server [Get help here]
4+
2. Tomcat Server [Get help here]
5+
6+
Procedure
7+
8+
1. download archetype maven-archetype-webapp
9+
```sh
10+
mvn archetype:generate -DgroupId=com.valaxy.webapp -DartifactId=helloworld-project -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
11+
```
12+
13+
1. Update pom.xml code to add maven plugin to copy artifacts onto tomcat
14+
this should be under <build>
15+
```sh
16+
<plugins>
17+
<plugin>
18+
<groupId>org.apache.tomcat.maven</groupId>
19+
<artifactId>tomcat8-maven-plugin</artifactId>
20+
<version>2.2</version>
21+
<configuration>
22+
<url>http://localhost:8080/manager/text</url>
23+
<server>TomcatServer</server>
24+
<path>/helloworld-webapp</path>
25+
</configuration>
26+
</plugin>
27+
</plugins>
28+
```
29+
30+
1. create settings.xml for credentials
31+
```sh
32+
<?xml version="1.0" encoding="UTF-8"?>
33+
<settings ...>
34+
<servers>
35+
36+
<server>
37+
<id>TomcatServer</id>
38+
<username>admin</username>
39+
<password>password</password>
40+
</server>
41+
42+
</servers>
43+
</settings>
44+
```
45+
46+
47+
1. Build and the project on tomcat
48+
```sh
49+
mvn tomcat7:deploy
50+
```

0 commit comments

Comments
 (0)