diff --git a/.classpath b/.classpath deleted file mode 100644 index a9deb857..00000000 --- a/.classpath +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.project b/.project deleted file mode 100644 index d72bb832..00000000 --- a/.project +++ /dev/null @@ -1,36 +0,0 @@ - - - LoginWebApp - NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.wst.common.project.facet.core.builder - - - - - org.eclipse.wst.validation.validationbuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.m2e.core.maven2Nature - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - - diff --git a/Dockerfile-mysql b/Dockerfile-mysql deleted file mode 100644 index fa3aefdc..00000000 --- a/Dockerfile-mysql +++ /dev/null @@ -1,5 +0,0 @@ -#Base image -FROM mysql:5.7.28 - -#COPY -COPY ./dump/devopsclass.sql /docker-entrypoint-initdb.d diff --git a/Dockerfile-tomcat b/Dockerfile-tomcat deleted file mode 100644 index 0cc4017a..00000000 --- a/Dockerfile-tomcat +++ /dev/null @@ -1,9 +0,0 @@ -#Base image -FROM tomcat:8.5 - -#COPY -COPY ./target/LoginWebApp.war /usr/local/tomcat/webapps/ - -WORKDIR /usr/local/tomcat/webapps/ - -CMD ["catalina.sh", "run"] diff --git a/Jenkinsfile b/Jenkinsfile index f1f2e9e3..c24a3d94 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,31 +1,78 @@ +// pipeline { +// agent any +// tools { +// maven "MAVEN" +// jdk "JDK" +// } + +// environment { +// NEXUS_VERSION = "nexus3" // Nexus 3 or Nexus 2 +// NEXUS_PROTOCOL = "http" // HTTP or HTTPS +// NEXUS_URL = "13.126.159.57:8081" // Nexus Server IP and Port +// NEXUS_REPOSITORY = "logicwebapp" // Nexus Repository Name +// NEXUS_CREDENTIAL_ID = "Nexus" // Jenkins Credential ID for Nexus +// ARTIFACT_VERSION = "${BUILD_NUMBER}" // Versioning +// GROUP_ID = "com/psrinivas" +// ARTIFACT_ID = "loginwebapp" +// } + +// stages { +// stage("Checkout Code") { +// steps { +// script { +// git branch: 'feature/nexusUpload', url: 'https://github.com/PSRINVAS-729/LoginWebApp.git' +// } +// } +// } + +// stage("Maven Build") { +// steps { +// sh "mvn clean install" +// } +// } + +// stage("Upload Artifact to Nexus") { +// steps { +// withCredentials([usernamePassword(credentialsId: 'Nexus', usernameVariable: 'NEXUS_USER', passwordVariable: 'NEXUS_PASS')]) { +// sh """ +// curl -v -u ${NEXUS_USER}:${NEXUS_PASS} --upload-file target/LoginWebApp.war ${NEXUS_URL}/repository/${NEXUS_REPOSITORY}/${GROUP_ID}/${ARTIFACT_ID}/${ARTIFACT_VERSION}/${ARTIFACT_ID}-${ARTIFACT_VERSION}.war +// """ +// } +// } +// } +// } +// } +// s3 upload pipeline { agent any tools { - maven 'localMaven' + maven "MAVEN" + jdk "JDK" } - parameters { - string(name: 'tomcat_stag', defaultValue: '35.154.81.229', description: 'Tomcat Staging Server') + environment { + S3_BUCKET = "jenkinss322" + AWS_REGION = "ap-south-1" // Change based on your region + AWS_CREDENTIALS_ID = "s3" } -stages{ - stage('Build'){ + stages { + stage("Checkout Code") { steps { - sh 'mvn clean package' + git branch: 'feature/nexusUpload', url: 'https://github.com/PSRINVAS-729/LoginWebApp.git' } - post { - success { - echo 'Archiving the artifacts' - archiveArtifacts artifacts: '**/*.war' - } + } + + stage("Maven Build") { + steps { + sh "mvn clean install" } } - stage ('Deployments'){ - stage ('Deploy to Staging Server'){ - steps { - sh "scp **/*.war jenkins@${params.tomcat_stag}:/usr/share/tomcat/webapps" - } + stage("Upload to S3") { + steps { + withAWS(credentials: 's3', region: "${AWS_REGION}") { + sh "whoami" } } } diff --git a/pom.xml b/pom.xml index 86876305..48caade7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,30 +1,72 @@ - - 4.0.0 - com.ranjitswain - LoginWebApp - war - 1.0-SNAPSHOT - LoginWebApp Maven Webapp - http://maven.apache.org - - - javax.servlet - servlet-api - 2.5 - - - mysql - mysql-connector-java - 8.0.12 - - - junit - junit - 4.10 - - - - LoginWebApp - + + + 4.0.0 + + com.PSRINIVAS-729 + logicwebapp + war + 1.0-SNAPSHOT + + LoginWebApp Maven Webapp + http://maven.apache.org + + + + + javax.servlet + javax.servlet-api + 4.0.1 + provided + + + + + mysql + mysql-connector-java + 8.0.12 + + + + + junit + junit + 4.13.2 + test + + + + + LoginWebApp + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + + + + + + central + https://repo.maven.apache.org/maven2 + + +