Skip to content

Commit 08cdf25

Browse files
cheswoop
authored andcommitted
Use Maven's --also-make by default
This is especially helpful for IntelliJ to work the way you expect. References #294
1 parent 6d049e2 commit 08cdf25

4 files changed

Lines changed: 39 additions & 17 deletions

File tree

.mvn/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Project-specific Maven Configuration
2+
====================================
3+
4+
<https://maven.apache.org/configure.html>
5+
6+
maven.config
7+
------------
8+
9+
Options to always give to the `mvn` CLI. This file doesn't support comments,
10+
which is largely the reason this README exists.
11+
12+
`--also-make` tells Maven to use [the Reactor] to recognize inter-module
13+
dependencies and include them in the build whenever necessary. This is generally
14+
desirable in a multi-module project.
15+
16+
In addition to saving typing on the command line, using `--also-make` as a
17+
default gets IntelliJ's main build & run functions working without failing to
18+
resolve the inter-module deps or [running afoul of the Enforcer plugin][1], as
19+
long as you use the ["Delegate IDE build/run actions to Maven"][2] setting.
20+
21+
[the Reactor]: https://maven.apache.org/guides/mini/guide-multiple-modules.html
22+
[1]: https://maven.apache.org/enforcer/enforcer-rules/reactorModuleConvergence.html
23+
[2]: https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html

.mvn/maven.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--also-make

CONTRIBUTING.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ cd feast
4646
#### Starting Feast Core
4747

4848
```
49-
cd $FEAST_HOME/core
50-
5149
# Please check the default configuration for Feast Core in
5250
# "$FEAST_HOME/core/src/main/resources/application.yml" and update it accordingly.
5351
#
5452
# Start Feast Core GRPC server on localhost:6565
55-
mvn spring-boot:run
53+
mvn --projects core spring-boot:run
5654
5755
# If Feast Core starts successfully, verify the correct Stores are registered
5856
# correctly, for example by using grpc_cli.
@@ -97,10 +95,8 @@ instances of Feast serving. If you start multiple Feast serving on a single host
9795
make sure that they are listening on different ports.
9896

9997
```
100-
cd $FEAST_HOME/serving
101-
10298
# Start Feast Serving GRPC server on localhost:6566 with store name "SERVING"
103-
mvn spring-boot:run -Dspring-boot.run.arguments='--feast.store-name=SERVING'
99+
mvn --projects serving spring-boot:run -Dspring-boot.run.arguments='--feast.store-name=SERVING'
104100
105101
# To verify Feast Serving starts successfully
106102
grpc_cli call localhost:6566 GetFeastServingType ''
@@ -245,30 +241,30 @@ _Note: integration suite isn't yet separated from unit._
245241

246242
The `core` and `serving` modules are Spring Boot applications. These may be run as usual for [the Spring Boot Maven plugin][boot-maven]:
247243

248-
$ mvn --also-make --projects core sprint-boot:run
244+
$ mvn --projects core spring-boot:run
249245

250246
# Or for short:
251-
$ mvn -am -pl core spring-boot:run
247+
$ mvn -pl core spring-boot:run
252248

253-
Note the use of `--also-make` since some components depend on library modules from within the project.
249+
Note that you should execute `mvn` from the Feast repository root directory, as there are intermodule dependencies that Maven will not resolve if you `cd` to subdirectories to run.
254250

255251
[boot-maven]: https://docs.spring.io/spring-boot/docs/current/maven-plugin/index.html
256252

257253
#### Running From IntelliJ
258254

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:
255+
Compiling and running tests in IntelliJ should work as usual.
256+
257+
Running the Spring Boot apps may work out of the box in IDEA Ultimate, which has built-in support for Spring Boot projects, but the Community Edition needs a bit of help:
260258

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].
259+
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].
263260

264-
Fortunately there is one simple way to address both:
261+
A solution to this is:
265262

266263
1. Open `View > Tool Windows > Maven`
267264
1. Drill down to e.g. `Feast Core > Plugins > spring-boot:run`, right-click and `Create 'feast-core [spring-boot'…`
268265
1. In the dialog that pops up, check the `Resolve Workspace artifacts` box
269266
1. Click `OK`. You should now be able to select this run configuration for the Play button in the main toolbar, keyboard shortcuts, etc.
270267

271-
[idea-also-make]: https://stackoverflow.com/questions/15073877/using-mavens-also-make-option-in-intellij
272268
[idea-boot-main]: https://stackoverflow.com/questions/30237768/run-spring-boots-main-using-ide
273269

274270
#### Tips for Running Postgres, Redis and Kafka with Docker

serving/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
### Getting Started Guide for Feast Serving Developers
22

33
Pre-requisites:
4+
45
- [Maven](https://maven.apache.org/install.html) build tool version 3.6.x
56
- A running Feast Core instance
67
- A running Store instance e.g. local Redis Store instance
78

8-
Run the following maven command to start Feast Serving GRPC service running on port 6566 locally
9+
From the Feast project root directory, run the following Maven command to start Feast Serving gRPC service running on port 6566 locally:
10+
911
```bash
1012
# Assumptions:
1113
# - Local Feast Core is running on localhost:6565
12-
mvn spring-boot:run -Dspring-boot.run.arguments=\
14+
mvn -pl serving spring-boot:run -Dspring-boot.run.arguments=\
1315
--feast.store.config-path=./sample_redis_config.yml,\
1416
--feast.core-host=localhost,\
1517
--feast.core-port=6565
@@ -88,4 +90,4 @@ with open("/tmp/000000000000.avro", "rb") as f:
8890
print(df.shape)
8991
print(df.head(5))
9092
EOF
91-
```
93+
```

0 commit comments

Comments
 (0)