Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
pipeline {
agent any
stages {
stage('Test') {
when {
anyOf {
branch 'production'
branch 'testing'
branch 'development'
}
}
steps {
sh 'mvn test'
}
}
stage('Build') {
when {
anyOf{
branch 'production'
branch 'testing'
branch 'development'
} }
steps {
sh 'mvn package'
}
}
stage('Deploy to Production') {
environment {
TOMCAT_URL = 'http://3.0.176.113:8080'
TOMCAT_USER = 'tomcat'
TOMCAT_PASSWORD = 'tomcat'

}
when {
branch 'production'
}

steps {
echo "This is Development branch" }
}
}
}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# sparkjava-war-example
Build war with maven and sparkjava framework
# java-war-example-HelloWorld
Build war with maven

Steps:

1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi)
1. Download a fresh [Tomcat 9 distribution](https://tomcat.apache.org/)
2. Clone this repository to your local machine
3. Run mvn package
4. Copy the generated `sparkjava-hello-world-1.0.war` to the Tomcat `webapps` folder
5. Start Tomcat by running `bin\startup.bat` (or `bin\startaup.sh` for Linux)
4. Copy the generated `java-war-example-HelloWorld .war` to the Tomcat `webapps` folder
5. Start Tomcat by running `bin\startup.bat` (or `bin\startup.sh` for Linux)
5. Tomcat will automatically deploy the war
6. Open [http://localhost:8080/sparkjava-hello-world-1.0/hello](http://localhost:8080/sparkjava-hello-world-1.0/hello) in your browser
6. Open [http://localhost:8080/java-war-example-HelloWorld/hello](http://localhost:8080/java-war-example-HelloWorld/hello) in your browser