-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
154 lines (139 loc) · 5.3 KB
/
build.gradle
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
plugins {
id 'java'
id 'war'
id 'maven-publish'
id "org.springframework.boot" version "2.1.8.RELEASE"
id "com.microsoft.azure.azurewebapp" version "1.2.0"
}
// NOTE: some of these versions are deliberately insecure for demonstration
ext {
springBootVersion = '2.1.8.RELEASE'
springSecurityVersion = '3.0.4.RELEASE'
log4jVersion = '2.4.13'
jacksonVersion = '2.13.0'
junitVersion = '4.12'
junitJupiterVersion = '5.7.0'
junitPlatformVersion = '1.7.1'
mockitoVersion = '4.11.0'
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
implementation "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-web:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-security:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-data-jdbc:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-log4j2:${log4jVersion}"
implementation "org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}"
modules {
module("org.springframework.boot:spring-boot-starter-logging") {
replacedBy("org.springframework.boot:spring-boot-starter-log4j2", "Use Log4j2 instead of Logback")
}
}
implementation "org.springframework.boot:spring-boot-devtools:${springBootVersion}"
implementation "org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}"
implementation "org.springframework.security:spring-security-taglibs:5.2.8.RELEASE"
implementation "org.apache.tomcat.embed:tomcat-embed-jasper"
implementation 'javax.servlet:jstl:1.2'
implementation 'com.h2database:h2:1.4.197'
implementation 'org.webjars:lodash:4.17.4'
implementation 'org.owasp.encoder:encoder:1.2.3'
testImplementation "org.hibernate.validator:hibernate-validator:6.1.0.Final"
testImplementation("org.springframework.boot:spring-boot-starter-test:${springBootVersion}") {
exclude group: "com.vaadin.external.google", module:"android-json"
}
testImplementation "junit:junit:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter:${junitJupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitJupiterVersion}"
testImplementation "org.junit.platform:junit-platform-engine:${junitPlatformVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junitJupiterVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-commons:${junitPlatformVersion}"
testRuntimeOnly "org.codehaus.groovy:groovy:3.0.8"
}
apply plugin: 'io.spring.dependency-management'
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
exclude module: 'spring-boot-starter-logging'
}
def props = new Properties()
def propertiesFile = project.file('.env')
if (!propertiesFile.exists()) {
props.setProperty('APP_NAME', 'OctaneDemoApp')
props.setProperty('APP_VER_NAME', '1.0')
Writer writer = new FileWriter(propertiesFile, false)
props.store(writer, "Change these variables to relevant values. Don't commit this file to source control.")
writer.close()
}
props.load(propertiesFile.newDataInputStream())
project.archivesBaseName = 'OctaneDemoApp'
group = 'com.opentext.app'
version = '1.0'
description = 'Insecure Web application for use in Fortify/ALM Octane demonstrations'
sourceCompatibility = '1.8'
sourceSets {
main {
java.srcDirs = ['src/main/java','src/iac']
resources.srcDirs= ['src/main/resources']
}
test {
java.srcDirs = ['src/test/java']
resources.srcDirs = ['src/test/resources']
}
}
azurewebapp {
subscription = props.getProperty("AZURE_SUBSCRIPTION_ID") // e.g. '17d2722b-256e-47e5-84b8-5b01f509a42c'
resourceGroup = props.getProperty("AZURE_RESOURCE_GROUP") // e.g. 'fortifydemorg'
appName = props.getProperty("AZURE_APP_NAME") // e.g. 'fortifydemoapp'
pricingTier = 'B2' // or larger capacity
region = props.getProperty("AZURE_REGION") // e.g. 'eastus'
runtime {
//os = 'Windows'
os = 'Linux'
webContainer = 'Tomcat 9.0'
//webContainer = 'Java SE'
javaVersion = 'Java 1.8'
}
appSettings {
key1=value1
}
auth {
type = 'azure_cli' // support azure_cli, oauth2, device_code and service_principal
}
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
test {
useJUnitPlatform()
reports {
junitXml.enabled = true
html.enabled = true
}
}
bootRun {
systemProperty "spring.profiles.active", "dev"
}
tasks.named('wrapper') {
distributionType = Wrapper.DistributionType.ALL
}
task writeClasspath() {
doLast() {
buildDir.mkdirs()
def files = configurations.compileClasspath.getFiles().sort()
new File(buildDir, "classpath.txt").text = files.collect { it.path }.join(';')
//files.forEach{ f -> print("$f.path;")}
}
}