-
Notifications
You must be signed in to change notification settings - Fork 1
/
pom.groovy
49 lines (34 loc) · 1.13 KB
/
pom.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
project {
modelVersion '4.0.0'
groupId 'org.exampledriven'
artifactId 'maven-polyglot-groovy-simple-example'
version '1.0-SNAPSHOT'
build {
$execute(id: 'hello', phase: 'compile', ) {
/*
ec ->
//Available starting polyglot-groovy 0.1.20
println 'Version : ' + ec.getProject().getModel().getVersion()
println 'Group ID : ' + ec.getProject().getModel().getGroupId()
println 'Artifact ID : ' + ec.getProject().getModel().getArtifactId()
println 'Basedir : ' + ec.basedir()
*/
if ('true'.equals(System.getProperty('file-test'))) {
println 'File generation is enabled'
def directory = 'target/classes/generated'
def dirCreated = new File(directory).mkdir();
println 'Directory was created? ' + dirCreated
def file = new File(directory + '/hello.txt')
if (!file.exists()) {
println 'Creating hello.txt'
file.createNewFile();
file.write('hello from groovy')
} else {
println 'hello.txt is already created'
}
} else {
println 'File generation is disabled'
}
}
}
}