├── .gitignore ├── CHANGES.md ├── Jenkinsfile ├── README.adoc ├── pom.xml └── src └── main └── webapp ├── WEB-INF └── web.xml └── index.jsp /.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ project files 2 | *.iml 3 | *.ipr 4 | *.iws 5 | .idea/ 6 | 7 | # eclipse project file 8 | .metadata 9 | .settings/ 10 | .classpath 11 | .project 12 | build/ 13 | .factorypath 14 | .fbExcludeFilterFile 15 | 16 | # withMaven from Jenkinsfile 17 | .repository/ 18 | 19 | # Maven generated files 20 | target/ 21 | release.properties 22 | pom.xml.releaseBackup 23 | 24 | # git-timestamp:release Maven plugin generated files 25 | VERSION.txt 26 | TAG_NAME.txt 27 | 28 | -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | [FEATURE-1] blah blah blah 2 | [FEATURE-2] blah blah blah 3 | [FEATURE-3] blah blah blah 4 | [FEATURE-4] blah blah blah 5 | [FEATURE-5] blah blah blah 6 | [FEATURE-6] blah blah blah 7 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | options { 4 | buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '1', daysToKeepStr: '', numToKeepStr: '10') 5 | disableConcurrentBuilds() 6 | } 7 | stages { 8 | stage('Build') { 9 | when { 10 | not { branch 'master' } 11 | } 12 | steps { 13 | withMaven(maven:'maven-3', jdk:'java-8', mavenLocalRepo: '.repository') { 14 | sh 'mvn verify' 15 | } 16 | } 17 | } 18 | stage('Release') { 19 | when { 20 | branch 'master' 21 | } 22 | steps { 23 | withMaven(maven:'maven-3', jdk:'java-8', mavenLocalRepo: '.repository') { 24 | sh 'mvn release:clean git-timestamp:setup-release release:prepare release:perform' 25 | } 26 | } 27 | post { 28 | success { 29 | // Publish the tag 30 | sshagent(['github-ssh']) { 31 | // using the full url so that we do not care if https checkout used in Jenkins 32 | sh 'git push git@github.com:cloudbeers/maven-continuous.git $(cat TAG_NAME.txt)' 33 | } 34 | // Set the display name to the version so it is easier to see in the UI 35 | script { currentBuild.displayName = readFile('VERSION.txt').trim() } 36 | 37 | // (If using a repository manager with staging support) Close staging repo 38 | } 39 | failure { 40 | // Remove the local tag as there is no matching remote tag 41 | sh 'test -f TAG_NAME.txt && git tag -d $(cat TAG_NAME.txt) && rm -f TAG_NAME.txt || true' 42 | 43 | // (If using a repository manager with staging support) Drop staging repo 44 | } 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /README.adoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudbeers/maven-continuous/c130fd05fd8a319ec0338f55ecb2ce4ffbae9bd8/README.adoc -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | io.github.cloudbeers 7 | maven-continuous 8 | 1.x-SNAPSHOT 9 | war 10 | 11 | maven-continuous Maven Webapp 12 | 13 | 14 | scm:git:https://github.com/cloudbeers/maven-continuous.git 15 | scm:git:ssh://git@github.com/cloudbeers/maven-continuous.git 16 | http://github.com/cloudbeers/maven-continuous 17 | HEAD 18 | 19 | 20 | 21 | UTF-8 22 | 1.8 23 | 1.8 24 | 25 | 26 | 27 | 28 | 29 | 30 | maven-clean-plugin 31 | 3.1.0 32 | 33 | 34 | maven-resources-plugin 35 | 3.1.0 36 | 37 | 38 | maven-compiler-plugin 39 | 3.8.0 40 | 41 | 42 | maven-surefire-plugin 43 | 2.22.1 44 | 45 | 46 | maven-war-plugin 47 | 3.2.2 48 | 49 | 50 | maven-install-plugin 51 | 2.5.2 52 | 53 | 54 | maven-deploy-plugin 55 | 2.8.2 56 | 57 | 58 | maven-release-plugin 59 | 2.5.3 60 | 61 | 62 | org.eclipse.jetty 63 | jetty-maven-plugin 64 | 9.4.15.v20190215 65 | 66 | 67 | 68 | 69 | 70 | maven-release-plugin 71 | 72 | true 73 | false 74 | validate 75 | 76 | 77 | 78 | com.github.stephenc.continuous 79 | git-timestamp-maven-plugin 80 | 1.40 81 | 82 | 83 | 84 | timestamp 85 | 86 | 87 | ${project.build.outputDirectory}/version.txt 88 | 89 | 90 | 91 | 92 | x-SNAPSHOT 93 | VERSION.txt 94 | TAG_NAME.txt 95 | false 96 | 97 | 98 | 99 | 100 | maven-deploy-plugin 101 | 102 | true 103 | 104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | Hello world application 7 | 8 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="java.io.InputStream" %> 2 | 3 | 4 |

Hello World!

5 | <% 6 | StringBuilder buf = new StringBuilder(); 7 | try (InputStream is = getClass().getResourceAsStream("/version.txt")) { 8 | int c; 9 | while (-1 != (c = is.read())) { 10 | buf.append((char)c); 11 | } 12 | } 13 | %> 14 | <%=buf%> 15 | 16 | 17 | --------------------------------------------------------------------------------