From 651a285a1460011a54e2c7b9300d2d7a52551e62 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Fri, 6 Oct 2017 16:37:36 +0200 Subject: [PATCH] Moving to maven --- .gitignore | 1 + Jenkinsfile | 42 +++++++++++------------ Zutil.iml | 18 ++++++++-- pom.xml | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+), 25 deletions(-) create mode 100755 pom.xml diff --git a/.gitignore b/.gitignore index afddf1a..fd621eb 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Zutil.jar /build/ /bin/ +/target/ diff --git a/Jenkinsfile b/Jenkinsfile index e3042bd..fa70dd6 100755 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,43 +1,41 @@ +#!groovy​ // Jenkinsfile (Pipeline Script) node { // Configure environment - env.JAVA_HOME = tool name: 'JDK8' env.REPO_URL = "repo.koc.se/zutil-java.git" //scm.getUserRemoteConfigs()[0].getUrl() env.BUILD_NAME = "BUILD-" + env.BUILD_ID checkout scm - stage('Build') { - sh 'ant clean' - sh 'ant build' - } + withMaven(JDK: "JDK8") { - stage('Test') { - try { - sh 'ant test' - } finally { - step([$class: 'JUnitResultArchiver', testResults: 'build/reports/*.xml']) + stage('Build') { + sh 'mvn clean compile' } - } + stage('Test') { + sh 'mvn surefire:test failsafe:integration-test' + } - stage('Package') { - sh 'ant package' - archiveArtifacts artifacts: 'build/release/*', fingerprint: true + stage('Package') { + sh 'mvn -DskipStatic -DskipTests install' - // Tag artifact - withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491', - usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { - sh "git tag ${env.BUILD_NAME}" - sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}" + // Tag artifact + withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'f8e5f6c6-4adb-4ab2-bb5d-1c8535dff491', + usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) { + sh "git tag ${env.BUILD_NAME}" + sh "git push 'https://${USERNAME}:${PASSWORD}@${env.REPO_URL}' ${env.BUILD_NAME}" + } } } } //stage('Deploy') { -// input message: 'Deploy?', submitter: 'ziver' -// node { -// sh 'ant deploy' +// timeout(time: 5, unit: 'HOURS') { +// input message: 'Deploy?', submitter: 'ziver' +// node { +// sh 'mvn deploy' +// } // } //} diff --git a/Zutil.iml b/Zutil.iml index cbd59c3..a2bde11 100755 --- a/Zutil.iml +++ b/Zutil.iml @@ -1,11 +1,13 @@ - - - + + + + + @@ -33,5 +35,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100755 index 0000000..85a497b --- /dev/null +++ b/pom.xml @@ -0,0 +1,95 @@ + + + + 4.0.0 + + koc.se + zutil + 1.0.0-SNAPSHOT + + Zutil + + + 1.8 + UTF-8 + + + + + commons-fileupload + commons-fileupload + 1.2.1 + + + commons-io + commons-io + 2.5 + + + dom4j + dom4j + 1.6.1 + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + + mysql + mysql-connector-java + 5.1.36 + + + org.xerial + sqlite-jdbc + 3.8.11.2 + + + + + junit + junit + 4.12 + test + + + org.hamcrest + hamcrest-core + 1.3 + + + com.carrotsearch + junit-benchmarks + 0.7.2 + + + + + src + test + + + src + + **/*.java + + + + + + + maven-compiler-plugin + 3.6.1 + + ${java.version} + ${java.version} + + + + + +