Netflix / mantis

A platform that makes it easy for developers to build realtime, cost-effective, operations-focused applications
Apache License 2.0
1.42k stars 202 forks source link

Errors building Mantis from source following official docs #604

Open jpittis opened 11 months ago

jpittis commented 11 months ago

Summary

Hey folks. I'm having some difficulty building the complete Mantis project, as well as its examples from source.

I assume this is my environment being incorrectly configured rather than an issue with the master branch.

It would be awesome if we could figure out what's missing and update the docs to include those dependencies.

Thanks for taking a look!

Reproduction

I get errors when following the build instructions in the README:

$ git clone git@github.com:Netflix/mantis.git
$ cd mantis
$ ./gradlew clean build
BUILD FAILED in 4s

I get similar errors when following the instructions from the "Local" tutorial:

$ git clone git@github.com:Netflix/mantis.git
$ cd mantis/mantis-examples/mantis-examples-synthetic-sourcejob
$ ../../gradlew execute
BUILD FAILED in 3s

I've demonstrated my environment is at least somewhat correctly setup by successfully building mantis-mql from source:

$ git clone https://github.com/Netflix/mantis-mql
$ ./gradlew clean build
BUILD SUCCESSFUL in 52s

Here's some metadata around what I believe is being used to build Mantis:

$ ./gradlew --version

------------------------------------------------------------
Gradle 7.5
------------------------------------------------------------

Build time:   2022-07-14 12:48:15 UTC
Revision:     c7db7b958189ad2b0c1472b6fe663e6d654a5103

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          17.0.6 (Eclipse Adoptium 17.0.6+10)
OS:           Mac OS X 14.1.2 aarch64

Details

It looks like at least two tasks are failing with quite loud stacktraces which I'm partially summarizing below:

> Task :mantis-common-serde:spotlessJava FAILED
Step 'removeUnusedImports' found problem in 'mantis-common-serde/src/main/java/io/mantisrx/common/JsonSerializer.java':
null
java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.RemoveUnusedImports (in unnamed module @0x2c6b2f25) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x2c6b2f25
        at com.google.googlejavaformat.java.RemoveUnusedImports.removeUnusedImports(RemoveUnusedImports.java:188)
        ... 136 more
> Task :mantis-common:compileJava FAILED
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OperatorOnErrorResumeNextViaFunction.java:76: warning: [deprecation] getInstance() in RxJavaPlugins has been deprecated
                    RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
                                 ^
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OperatorOnErrorResumeNextViaFunction.java:76: warning: [deprecation] handleError(Throwable) in RxJavaErrorHandler has been deprecated
                    RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
                                                                 ^
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OnSubscribeRedo.java:79: warning: [deprecation] <T>create(OnSubscribe<T>) in Observable has been deprecated
        return create(new OnSubscribeRedo<T>(source, notificationHandler, true, false, Schedulers.trampoline()));
               ^
  where T is a type-variable:
    T extends Object declared in method <T>create(OnSubscribe<T>)
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OnSubscribeRedo.java:83: warning: [deprecation] <T>create(OnSubscribe<T>) in Observable has been deprecated
        return create(new OnSubscribeRedo<T>(source, notificationHandler, true, false, scheduler));
               ^
  where T is a type-variable:
    T extends Object declared in method <T>create(OnSubscribe<T>)
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OnSubscribeRedo.java:108: warning: [deprecation] <T>create(OnSubscribe<T>) in Observable has been deprecated
        return create(new OnSubscribeRedo<T>(source, notificationHandler, false, true, Schedulers.trampoline()));
               ^
  where T is a type-variable:
    T extends Object declared in method <T>create(OnSubscribe<T>)
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OnSubscribeRedo.java:112: warning: [deprecation] <T>create(OnSubscribe<T>) in Observable has been deprecated
        return create(new OnSubscribeRedo<T>(source, notificationHandler, false, true, scheduler));
               ^
  where T is a type-variable:
    T extends Object declared in method <T>create(OnSubscribe<T>)
/Users/jpittis/mantis/mantis-common/src/main/java/io/reactivx/mantis/operators/OnSubscribeRedo.java:116: warning: [deprecation] <T>create(OnSubscribe<T>) in Observable has been deprecated
        return create(new OnSubscribeRedo<T>(source, notificationHandler, false, false, scheduler));
               ^
  where T is a type-variable:
    T extends Object declared in method <T>create(OnSubscribe<T>)
7 warnings
An exception has occurred in the compiler (17.0.6). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException: Cannot read field "bindingsWhenTrue" because "currentBindings" is null
        at jdk.compiler/com.sun.tools.javac.comp.Attr.handleSwitch(Attr.java:1794)
...
calvin681 commented 11 months ago

I think this issue is due to JDk17. Try using JDK8 to build. https://sdkman.io/ would be helpful in managing multiple java versions.

jpittis commented 11 months ago

Thanks so much. After installing sdkman, I was able to successfully build Mantis using JDK8:

$ sdk install java 8.0.392-amzn
$ ./gradlew --info --stacktrace build --warning-mode=all
BUILD SUCCESSFUL in 4m 6s

We should action this ticket by updating the docs from claiming "JDK 8 or higher" to just "JDK 8" and potentially mention sdkman as well as a recommended vendor and version.