diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..4babee58 --- /dev/null +++ b/Jenkinsfile @@ -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" } + } + } +} diff --git a/README.md b/README.md index 8d7640e7..8e3ea2f4 100644 --- a/README.md +++ b/README.md @@ -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