Skip to content

Commit c2339b0

Browse files
committed
buildJava Template
1 parent faaf273 commit c2339b0

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

documentation/Functions.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,12 @@ cobiGenJava("path/to/java/file/MyEntity.java",[1,3,5,6,8])
4040
createDevon4jProject("cobigenexample")
4141

4242
***
43+
44+
### buildJava
45+
#### parameter
46+
1. The project directory
47+
2. Indicator whether tests should be run
48+
#### example
49+
buildJava("cobigenexample", true)
50+
51+
***

runners/console/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export class Console extends Runner {
7979
return null;
8080
}
8181

82+
runBuildJava(step: Step, command: Command): RunResult {
83+
return null;
84+
}
85+
8286
async assertInstallDevonfwIde(step: Step, command: Command, result: RunResult) {
8387
let installedTools = command.parameters[0];
8488

@@ -120,6 +124,11 @@ export class Console extends Runner {
120124
.fileExits(path.join(workspaceDir, command.parameters[0], "core", "src", "main", "java", "com", "example", "application", command.parameters[0], "SpringBootApp.java"));
121125
}
122126

127+
async assertbuildJava(step: Step, command: Command, result: RunResult) {
128+
console.log("assertbuildJava exceptions");
129+
}
130+
131+
123132
private executeCommandSync(command: string, directory: string, result: RunResult, input?: string) {
124133
if(result.returnCode != 0) return;
125134

runners/katacoda/buildJava.md

Whitespace-only changes.

runners/katacoda/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,28 @@ export class Katacoda extends Runner {
112112
return null;
113113
}
114114

115+
runCreateDevon4jProject(step: Step, command: Command): RunResult{
116+
let cdCommand = "/root/devonfw";
117+
this.steps.push({
118+
"title": "CobiGen Java",
119+
"text": "step" + this.stepsCount + ".md"
120+
});
121+
this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand, skipTest: command.parameters[1]});
122+
return null;
123+
}
124+
125+
runBuildJava(step: Step, command: Command): RunResult{
126+
let cdCommand = "/root/devonfw/workspace/" + command.parameters[0];
127+
128+
this.steps.push({
129+
"title": "Build Java",
130+
"text": "step" + this.stepsCount + ".md"
131+
});
132+
this.renderTemplate("buildJava.md", this.outputPathTutorial + "step" + (this.stepsCount++) + ".md", { text: step.text, textAfter: step.textAfter, cdCommand: cdCommand, skipTest: command.parameters[1]});
133+
return null;
134+
135+
}
136+
115137
private renderTemplate(name: string, targetPath: string, variables) {
116138
let template = fs.readFileSync(path.join(this.getRunnerDirectory(),"templates", name), 'utf8');
117139
let result = ejs.render(template, variables);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<%= text; %>
2+
3+
## Build the java project
4+
5+
<%= cdCommand; %>
6+
7+
Use the following devon command to build the java project.
8+
9+
`devon mvn clean install -Dmaven.test.skip=<%= skipTest; %>`{{execute}}
10+
11+
The maven command 'clean' will clear the target directory beforehand.
12+
13+
We do not need to execute the test cases, so we can skip them by using the option '-Dmaven.test.skip=<%= skipTest; %>'.
14+
15+
<%= textAfter; %>

0 commit comments

Comments
 (0)