Skip to content

Commit 18d54b7

Browse files
chesfeast-ci-bot
authored andcommitted
Import Spring Boot's dependency BOM, fix spring-boot:run at parent project level (#276)
* Fix using spring-boot:run from project root A little fix when some subproject modules are Spring Boot apps, but the parent is not. Also document how to overcome IntelliJ CE woes with Spring Boot, and inter-module Maven dependencies. * Get Spring managed dep versions via their BOM Spring has done the work of finding direct and transitive versions of dependencies compatible with their ecosystem, and declaring them as a BOM. It's in our best interest to heed it as much as we can. * ci: Try --also-make instead of skipping Enforcer Per discussion: #271 (comment) The `install` step should not be necessary for the unit tests, but we should use `--batch-mode` on the test step for CI. * Remove maven-shade-plugin from core It was resulting in a non-functional JAR, appears to be incomplete configuration. It seems unlikely to me that core will be used as a library, if there is a need the shading configuration can be fixed but it probably needs other considerations anyway.
1 parent 9cc1673 commit 18d54b7

7 files changed

Lines changed: 124 additions & 191 deletions

File tree

.prow/scripts/test-serving.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44
--archive-uri gs://feast-templocation-kf-feast/.m2.2019-10-24.tar \
55
--output-dir /root/
66

7-
# Skip Maven enforcer: https://stackoverflow.com/questions/50647223/maven-enforcer-issue-when-running-from-reactor-level
8-
mvn --projects serving --batch-mode --define skipTests=true \
9-
--define enforcer.skip=true clean install
10-
mvn --projects serving --define enforcer.skip=true test
7+
mvn --batch-mode --also-make --projects serving test
118
TEST_EXIT_CODE=$?
129

1310
# Default artifact location setting in Prow jobs
1411
LOGS_ARTIFACT_PATH=/logs/artifacts
1512
cp -r serving/target/surefire-reports ${LOGS_ARTIFACT_PATH}/surefire-reports
1613

17-
exit ${TEST_EXIT_CODE}
14+
exit ${TEST_EXIT_CODE}

CONTRIBUTING.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,55 @@ entity_dataset {
223223
'
224224
```
225225

226-
#### Tips for quickly running Postgres, Redis and Kafka locally with Docker
226+
## Development
227+
228+
Notes:
229+
230+
- Use of Lombok is being phased out, prefer to use [Google Auto] in new code.
231+
232+
[Google Auto]: https://github.com/google/auto
233+
234+
### Running Unit Tests
235+
236+
$ mvn test
237+
238+
### Running Integration Tests
239+
240+
_Note: integration suite isn't yet separated from unit._
241+
242+
$ mvn verify
243+
244+
### Running Components Locally
245+
246+
The `core` and `serving` modules are Spring Boot applications. These may be run as usual for [the Spring Boot Maven plugin][boot-maven]:
247+
248+
$ mvn --also-make --projects core sprint-boot:run
249+
250+
# Or for short:
251+
$ mvn -am -pl core spring-boot:run
252+
253+
Note the use of `--also-make` since some components depend on library modules from within the project.
254+
255+
[boot-maven]: https://docs.spring.io/spring-boot/docs/current/maven-plugin/index.html
256+
257+
#### Running From IntelliJ
258+
259+
IntelliJ IDEA Ultimate has built-in support for Spring Boot projects, so everything may work out of the box. The Community Edition needs help with two matters:
260+
261+
1. The IDE is [not clever enough][idea-also-make] to apply `--also-make` for Maven when it should.
262+
1. The Spring Boot Maven plugin automatically puts dependencies with `provided` scope on the runtime classpath when using `spring-boot:run`, such as its embedded Tomcat server. The "Play" buttons in the gutter or right-click menu of a `main()` method [do not do this][idea-boot-main].
263+
264+
Fortunately there is one simple way to address both:
265+
266+
1. Open `View > Tool Windows > Maven`
267+
1. Drill down to e.g. `Feast Core > Plugins > spring-boot:run`, right-click and `Create 'feast-core [spring-boot'…`
268+
1. In the dialog that pops up, check the `Resolve Workspace artifacts` box
269+
1. Click `OK`. You should now be able to select this run configuration for the Play button in the main toolbar, keyboard shortcuts, etc.
270+
271+
[idea-also-make]: https://stackoverflow.com/questions/15073877/using-mavens-also-make-option-in-intellij
272+
[idea-boot-main]: https://stackoverflow.com/questions/30237768/run-spring-boots-main-using-ide
273+
274+
#### Tips for Running Postgres, Redis and Kafka with Docker
227275

228276
This guide assumes you are running Docker service on a bridge network (which
229277
is usually the case if you're running Linux). Otherwise, you may need to

core/pom.xml

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,45 +33,11 @@
3333
<build>
3434
<plugins>
3535
<plugin>
36-
<groupId>org.apache.maven.plugins</groupId>
37-
<artifactId>maven-shade-plugin</artifactId>
38-
<version>2.4.3</version>
36+
<groupId>org.springframework.boot</groupId>
37+
<artifactId>spring-boot-maven-plugin</artifactId>
3938
<configuration>
40-
<transformers>
41-
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
42-
<resource>META-INF/spring.handlers</resource>
43-
</transformer>
44-
<transformer implementation="org.springframework.boot.maven.PropertiesMergingResourceTransformer">
45-
<resource>META-INF/spring.factories</resource>
46-
</transformer>
47-
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
48-
<resource>META-INF/spring.schemas</resource>
49-
</transformer>
50-
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
51-
<resource>META-INF/spring.components</resource>
52-
</transformer>
53-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
54-
<mainClass>feast.core.CoreApplication</mainClass>
55-
</transformer>
56-
<transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
57-
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
58-
</transformers>
39+
<skip>false</skip>
5940
</configuration>
60-
<executions>
61-
<execution>
62-
<phase>package</phase>
63-
<goals>
64-
<goal>shade</goal>
65-
</goals>
66-
</execution>
67-
</executions>
68-
<dependencies>
69-
<dependency>
70-
<groupId>org.springframework.boot</groupId>
71-
<artifactId>spring-boot-maven-plugin</artifactId>
72-
<version>${springBootVersion}</version>
73-
</dependency>
74-
</dependencies>
7541
</plugin>
7642
<plugin>
7743
<groupId>org.xolstice.maven.plugins</groupId>
@@ -87,6 +53,14 @@
8753
<version>${project.version}</version>
8854
</dependency>
8955

56+
<!-- Hot reloading for Spring Boot. spring-boot-maven-plugin removes
57+
this automatically when packaging. -->
58+
<dependency>
59+
<groupId>org.springframework.boot</groupId>
60+
<artifactId>spring-boot-devtools</artifactId>
61+
<optional>true</optional>
62+
</dependency>
63+
9064
<dependency>
9165
<groupId>javax.inject</groupId>
9266
<artifactId>javax.inject</artifactId>
@@ -111,7 +85,6 @@
11185
<dependency>
11286
<groupId>org.springframework.boot</groupId>
11387
<artifactId>spring-boot-starter-data-jpa</artifactId>
114-
<version>${springBootVersion}</version>
11588
</dependency>
11689
<!--compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"-->
11790
<dependency>
@@ -125,7 +98,6 @@
12598
<artifactId>spring-boot-configuration-processor</artifactId>
12699
</dependency>
127100

128-
129101
<!--compile "io.grpc:grpc-services:${grpcVersion}"-->
130102
<dependency>
131103
<groupId>io.grpc</groupId>
@@ -175,8 +147,8 @@
175147
<dependency>
176148
<groupId>org.postgresql</groupId>
177149
<artifactId>postgresql</artifactId>
178-
<version>42.2.5</version>
179-
<scope>runtime</scope>
150+
<scope>provided</scope>
151+
<optional>true</optional>
180152
</dependency>
181153

182154
<dependency>
@@ -190,10 +162,9 @@
190162
<artifactId>lombok</artifactId>
191163
</dependency>
192164

193-
<!--testCompile 'org.hamcrest:hamcrest-all:1.3'-->
194165
<dependency>
195166
<groupId>org.hamcrest</groupId>
196-
<artifactId>hamcrest-all</artifactId>
167+
<artifactId>hamcrest-library</artifactId>
197168
</dependency>
198169

199170
<!--testCompile 'com.jayway.jsonpath:json-path-assert:2.2.0'-->
@@ -213,10 +184,12 @@
213184
<dependency>
214185
<groupId>org.springframework.boot</groupId>
215186
<artifactId>spring-boot-test</artifactId>
187+
<scope>test</scope>
216188
</dependency>
217189
<dependency>
218190
<groupId>org.springframework.boot</groupId>
219191
<artifactId>spring-boot-test-autoconfigure</artifactId>
192+
<scope>test</scope>
220193
</dependency>
221194
</dependencies>
222195
</project>

core/src/test/java/feast/core/job/dataflow/DataflowJobMonitorTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import feast.types.FieldProto.Field;
3636
import feast.types.ValueProto.BoolList;
3737
import feast.types.ValueProto.Value;
38-
import feast.types.ValueProto.ValueType;
3938
import java.io.IOException;
4039
import org.junit.Before;
4140
import org.junit.Test;

ingestion/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@
248248
<dependency>
249249
<groupId>org.apache.kafka</groupId>
250250
<artifactId>kafka_2.12</artifactId>
251-
<version>2.3.0</version>
252251
<scope>test</scope>
253252
</dependency>
254253

0 commit comments

Comments
 (0)