File tree Expand file tree Collapse file tree 8 files changed +157
-0
lines changed
src/it/hotfix-finish-it-3 Expand file tree Collapse file tree 8 files changed +157
-0
lines changed Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
2+ <modelVersion >4.0.0</modelVersion >
3+
4+ <parent >
5+ <groupId >com.amashchenko.maven.plugin</groupId >
6+ <artifactId >gitflow-maven-test</artifactId >
7+ <version >1.0</version >
8+ </parent >
9+
10+ <artifactId >gitflow-maven-test-child1</artifactId >
11+ <packaging >pom</packaging >
12+ </project >
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
2+ <modelVersion >4.0.0</modelVersion >
3+
4+ <parent >
5+ <groupId >com.amashchenko.maven.plugin</groupId >
6+ <artifactId >gitflow-maven-test</artifactId >
7+ <version >1.0</version >
8+ </parent >
9+
10+ <artifactId >gitflow-maven-test-child2</artifactId >
11+ <packaging >pom</packaging >
12+
13+ <dependencyManagement >
14+ <dependencies >
15+ <dependency >
16+ <groupId >com.amashchenko.maven.plugin</groupId >
17+ <artifactId >gitflow-maven-test-child1</artifactId >
18+ <version >${test.project.version} </version >
19+ <type >pom</type >
20+ <scope >import</scope >
21+ </dependency >
22+ </dependencies >
23+ </dependencyManagement >
24+ </project >
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
2+ <modelVersion >4.0.0</modelVersion >
3+ <groupId >com.amashchenko.maven.plugin</groupId >
4+ <artifactId >gitflow-maven-test</artifactId >
5+ <packaging >pom</packaging >
6+ <version >1.0.1</version >
7+
8+ <modules >
9+ <module >child1</module >
10+ <module >child2</module >
11+ </modules >
12+
13+ <properties >
14+ <test .project.version>1.0.1</test .project.version>
15+ </properties >
16+ </project >
Original file line number Diff line number Diff line change 1+ build.log
2+ expected-development-pom.xml
3+ expected-production-pom.xml
4+ expected-release-pom.xml
5+ invoker.properties
6+ init.bsh
7+ verify.bsh
Original file line number Diff line number Diff line change 1+ import org.codehaus.plexus.util.FileUtils;
2+
3+ try {
4+ new File(basedir, "gitignorefile").renameTo(new File(basedir, ".gitignore"));
5+
6+ Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " init");
7+ p.waitFor();
8+
9+ Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.email '
[email protected] '");
10+ p.waitFor();
11+ Process p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " config user.name 'a'");
12+ p.waitFor();
13+
14+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
15+ p.waitFor();
16+
17+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m init");
18+ p.waitFor();
19+
20+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " branch hotfix/1.0.1");
21+ p.waitFor();
22+
23+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout hotfix/1.0.1");
24+ p.waitFor();
25+
26+ for (String fileName : new String[] {"pom.xml", "child1/pom.xml", "child2/pom.xml"}) {
27+ File pomfile = new File(basedir, fileName);
28+ String pomfilestr = FileUtils.fileRead(pomfile, "UTF-8");
29+ pomfilestr = pomfilestr.replaceAll("1.0", "1.0.1-SNAPSHOT");
30+ FileUtils.fileWrite(basedir + "/" + fileName, "UTF-8", pomfilestr);
31+ }
32+
33+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " add .");
34+ p.waitFor();
35+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " commit -m next");
36+ p.waitFor();
37+
38+ } catch (Exception e) {
39+ e.printStackTrace();
40+ return false;
41+ }
42+ return true;
Original file line number Diff line number Diff line change 1+ invoker.goals =${project.groupId}:${project.artifactId}:${project.version}:hotfix-finish -DpushRemote =false -DfetchRemote =false -B -DhotfixVersion =1.0.1 -DuseSnapshotInHotfix =true -DskipMergeDevBranch =true -DversionProperty =test.project.version
2+
3+ invoker.description =Check that versions:set and versions:set-property are applied in the same run. Otherwise, hotfix-finish fails on versions:set-property as pom version is inconsistent (mixed 1.0.1-SNAPSHOT and 1.0.1).
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
2+ <modelVersion >4.0.0</modelVersion >
3+ <groupId >com.amashchenko.maven.plugin</groupId >
4+ <artifactId >gitflow-maven-test</artifactId >
5+ <packaging >pom</packaging >
6+ <version >1.0</version >
7+
8+ <modules >
9+ <module >child1</module >
10+ <module >child2</module >
11+ </modules >
12+
13+ <properties >
14+ <test .project.version>1.0</test .project.version>
15+ </properties >
16+ </project >
Original file line number Diff line number Diff line change 1+ import org.codehaus.plexus.util.FileUtils;
2+
3+ try {
4+
5+ File gitTag = new File(basedir, ".git/refs/tags/1.0.1");
6+ if (!gitTag.exists()) {
7+ System.out.println("hotfix-finish .git/refs/tags/1.0.1 does not exist");
8+ return false;
9+ }
10+ File gitMasterRef = new File(basedir, ".git/refs/heads/master");
11+ if (!gitMasterRef.exists()) {
12+ System.out.println("hotfix-finish .git/refs/heads/master doesn't exist");
13+ return false;
14+ }
15+
16+ p = Runtime.getRuntime().exec("git --git-dir=" + basedir + "/.git --work-tree=" + basedir + " checkout master");
17+ p.waitFor();
18+
19+ file = new File(basedir, "pom.xml");
20+ expectedFile = new File(basedir, "expected-production-pom.xml");
21+
22+ actual = FileUtils.fileRead(file, "UTF-8");
23+ expected = FileUtils.fileRead(expectedFile, "UTF-8");
24+
25+ actual = actual.replaceAll("\\r?\\n", "");
26+ expected = expected.replaceAll("\\r?\\n", "");
27+
28+ if (!expected.equals(actual)) {
29+ System.out.println("hotfix-finish: " + expected + " actual was:" + actual);
30+ return false;
31+ }
32+
33+ } catch (Exception e) {
34+ e.printStackTrace();
35+ return false;
36+ }
37+ return true;
You can’t perform that action at this time.
0 commit comments