From 3ee630743b9b6a5f8cfc12092428e340e89fe96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A9=E7=A7=8B=E8=8D=A3?= Date: Sat, 23 Nov 2019 21:41:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Jenkinsfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 000000000..3b73bb2ae --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,49 @@ +pipeline { + agent any + stages { + stage('检出') { + steps { + checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]], + userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]]) + } + } + stage('构建') { + steps { + sh 'mvn -version' + echo '构建中...' + sh 'mvn clean install -Dmaven.test.skip=true' + echo '构建完成.' + script { + def exists = fileExists 'README.md' + if (!exists) { + writeFile(file: 'README.md', text: 'Helloworld') + } + } + + archiveArtifacts(artifacts: 'README.md', fingerprint: true) + } + } + stage('测试') { + steps { + echo '单元测试中...' + echo '单元测试完成.' + writeFile(file: 'TEST-demo.junit4.AppTest.xml', text: ''' + + + + + + + + ''') + junit '*.xml' + } + } + stage('部署') { + steps { + echo '部署中...' + echo '部署完成' + } + } + } +} \ No newline at end of file From 6e004d7facaa8eb0f21f7772a9ef656d693bcf25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A9=E7=A7=8B=E8=8D=A3?= Date: Sat, 23 Nov 2019 21:45:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Jenkinsfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3b73bb2ae..b857ab48a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stage('检出') { steps { checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]], - userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]]) + userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]]) } } stage('构建') { @@ -13,14 +13,7 @@ pipeline { echo '构建中...' sh 'mvn clean install -Dmaven.test.skip=true' echo '构建完成.' - script { - def exists = fileExists 'README.md' - if (!exists) { - writeFile(file: 'README.md', text: 'Helloworld') - } - } - - archiveArtifacts(artifacts: 'README.md', fingerprint: true) + archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true // 收集构建产物 } } stage('测试') { From cef8797cf0812e555572aa0c673fd9a75c07905a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A9=E7=A7=8B=E8=8D=A3?= Date: Sat, 23 Nov 2019 22:16:42 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Jenkinsfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b857ab48a..ed62484ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,16 +4,16 @@ pipeline { stage('检出') { steps { checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]], - userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]]) + userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]]) } } stage('构建') { steps { sh 'mvn -version' echo '构建中...' - sh 'mvn clean install -Dmaven.test.skip=true' + sh 'mvn -U clean package -Dmaven.test.skip=true' echo '构建完成.' - archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true // 收集构建产物 + archiveArtifacts(artifacts: '**/target/*.jar', fingerprint: true) } } stage('测试') {