Skip to content

Commit 89d8de8

Browse files
committed
added sequential mvn initialize in api-wiser-archetype
1 parent d146130 commit 89d8de8

2 files changed

Lines changed: 23 additions & 13 deletions

File tree

api-wiser-archetype/src/main/resources/META-INF/archetype-post-generate.groovy

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,27 @@ if (apiTargetFile.exists()) {
3333
println "Adding api file from a template ($apiTemplateFile)."
3434
}
3535

36-
def proc = new ProcessBuilder(["mvn", "wrapper:wrapper", "initialize", "initialize"])
37-
.directory(outputDir)
38-
.redirectErrorStream(true)
39-
.start()
40-
proc.inputStream.eachLine {println it}
41-
proc.waitForOrKill(10000)
42-
if( proc.exitValue() != 0){
43-
String errorMsg = "ERROR during the maven execution."
44-
println "-> $errorMsg"
45-
throw new Exception("$errorMsg")
46-
} else {
47-
println "-> Finished maven execution"
36+
def runMaven(File workDir, String... args) {
37+
def baseCommand = ["mvn"]
38+
def command = baseCommand + args.toList()
39+
40+
def proc = new ProcessBuilder(command)
41+
.directory(workDir)
42+
.redirectErrorStream(true)
43+
.start()
44+
45+
proc.inputStream.eachLine { println it }
46+
proc.waitForOrKill(10000)
47+
48+
if (proc.exitValue() != 0) {
49+
def errorMsg = "ERROR during maven execution: ${args.join(' ')}"
50+
println "-> $errorMsg"
51+
throw new Exception(errorMsg)
52+
}
53+
54+
println "-> Finished maven execution: ${args.join(' ')}"
4855
}
4956

57+
runMaven(outputDir, "wrapper:wrapper")
58+
runMaven(outputDir, "initialize")
59+
runMaven(outputDir, "initialize")

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<properties>
3030
<pom.root.parent.groupId>org.metalib.maven.pom</pom.root.parent.groupId>
3131
<pom.root.parent.artifactId>metalib-spring-pom</pom.root.parent.artifactId>
32-
<pom.root.parent.version>0.0.69</pom.root.parent.version>
32+
<pom.root.parent.version>0.0.70</pom.root.parent.version>
3333
<api-wiser.groupId>org.metalib.api.wiser</api-wiser.groupId>
3434
<api-wiser.artifactId>api-wiser</api-wiser.artifactId>
3535
<api-wiser.version>${project.version}</api-wiser.version>

0 commit comments

Comments
 (0)