spacemacs使用meghanada打开android gradle工程.meghanada.conf配置不生效

使用spacemacs的develop分支,java backend使用meghanada, 打开一个android app工程,默认构建是gradle的,然后我在app目录下配置了.meghanada.conf文件,重启emacs,看起来meghanada直接去解析了build.gradle文件,.meghanada.conf没有生效,如果build.gradle和meghanada.conf两个文件同时存在,是不是meghanada就忽略conf文件了?看下面的打印像是解析build.gradle配置打印的

使用meghanada-show-project打印如下:

System:

os: Linux osVersion: 5.8.0-34-generic osArch: amd64 memory: memory usage (used/total/max): 229.00MB / 789.00MB / 3948.00MB

Meghanada:

meghanadaVersion: 1.3.1-4d1e3bf meghanadaPath: /home/liweigao/.emacs.d/.cache/meghanada/meghanada-1.3.1.jar meghanadaServerPort: 40289 emacsMeghanada: /home/liweigao/.emacs.d/meghanada userHome: /home/liweigao useFastBoot: true classCompletionMatcher: prefix completionMatcher: prefix useJavaVersion: 11 javacArg: -Xlint:all useSourceCache: true cacheInProject: false cacheRoot: /home/liweigao/.cache/meghanada useExternalBuilder: false clearCacheOnStart: false isSkipBuildSubProjects: true useAOSPStyleFormat: false mavenLocalRepository: /home/liweigao/.m2/repository useFullTextSearch: false enableIdleCache: true

Java:

javaHome: /usr/lib/jvm/java-11-openjdk-amd64 javaVersion: 11.0.9.1 compileSource: 1.8 compileTarget: 1.8 javaExecArgs: [] classpath: /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.1.0/e3a6fb2f40e3a3842e6b7472628ba4ce416ea4c8/annotation-1.1.0.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/junit/junit/4.13.1/cdd00374f1fee76b11e2a9d127405aa3f6be5b6a/junit-4.13.1.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-integration/1.3/5de0c73fef18917cd85d0ab70bb23818685e4dfd/hamcrest-integration-1.3.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-common/2.1.0/b3152fc64428c9354344bd89848ecddc09b6f07e/core-common-2.1.0.jar /home/liweigao/Android/Sdk/platforms/android-30/android.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/4785a3c21320980282f9f33d0d1264a69040538f/hamcrest-library-1.3.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.1.0/c67e7807d9cd6c329b9d0218b2ec4e505dd340b7/lifecycle-common-2.1.0.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/2.0.1/516c03b21d50a644d538de0f0369c620989cd8f0/jsr305-2.0.1.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.collection/collection/1.1.0/1f27220b47669781457de0d600849a5de0e89909/collection-1.1.0.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.constraintlayout/constraintlayout-solver/2.0.4/1f001d7db280a89a6c26b26a66eb064bb6d5efeb/constraintlayout-solver-2.0.4.jar /home/liweigao/work/project/android-test/app/build/intermediates/app_classes/debug /home/liweigao/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar /home/liweigao/.gradle/caches/modules-2/files-2.1/com.squareup/javawriter/2.1.1/67ff45d9ae02e583d0f9b3432a5ebbe05c30c966/javawriter-2.1.1.jar /home/liweigao/.gradle/caches/transforms-2/files-2.1/69df24f507dd720395403495b7b06b0d/jetified-junit-1.1.2/jars/classes.jar

SystemProperties: awt.toolkit: sun.awt.X11.XToolkit file.encoding: UTF-8 file.separator: / home: /home/liweigao/.emacs.d/.cache/meghanada java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment java.awt.printerjob: sun.print.PSPrinterJob java.class.path: /home/liweigao/.emacs.d/.cache/meghanada/meghanada-1.3.1.jar java.class.version: 55.0 java.home: /usr/lib/jvm/java-11-openjdk-amd64 java.io.tmpdir: /tmp/1612490902958-0 java.library.path: /usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib java.net.preferIPv4Stack: true java.runtime.name: OpenJDK Runtime Environment java.runtime.version: 11.0.9.1+1-Ubuntu-0ubuntu1.20.04 java.specification.name: Java Platform API Specification java.specification.vendor: Oracle Corporation java.specification.version: 11 java.vendor: Ubuntu java.vendor.url: https://ubuntu.com/ java.vendor.url.bug: https://bugs.launchpad.net/ubuntu/+source/openjdk-lts java.version: 11.0.9.1 java.version.date: 2020-11-04 java.vm.compressedOopsMode: Zero based java.vm.info: mixed mode, sharing java.vm.name: OpenJDK 64-Bit Server VM java.vm.specification.name: Java Virtual Machine Specification java.vm.specification.vendor: Oracle Corporation java.vm.specification.version: 11 java.vm.vendor: Ubuntu java.vm.version: 11.0.9.1+1-Ubuntu-0ubuntu1.20.04 jdk.debug: release library.jansi.path: /home/liweigao/.gradle/native/jansi/1.18/linux64 line.separator:

meghanada-server.uid: 36b76a53ff5377f516ae7268b024889155346a99fa6547ed7297e7b5d3706fb3 meghanada-server.version: 1.3.1-4d1e3bf meghanada.android.project: true meghanada.android.project.name: app meghanada.cache.in.project: false meghanada.class.completion.matcher: prefix meghanada.completion.matcher: prefix meghanada.format: sexp meghanada.javac.arg: -Xlint:all meghanada.maven.path: mvn meghanada.search.static.method.classes: java.util.Objects,org.junit.Assert meghanada.server.port: 40289 meghanada.skip.build.subprojects: true meghanada.zpage.enable: true meghanada.zpage.port: 52473 os.arch: amd64 os.name: Linux os.version: 5.8.0-34-generic path.separator: : project.root: /home/liweigao/work/project/android-test/app sun.arch.data.model: 64 sun.boot.library.path: /usr/lib/jvm/java-11-openjdk-amd64/lib sun.cpu.endian: little sun.cpu.isalist: sun.desktop: gnome sun.io.unicode.encoding: UnicodeLittle sun.io.useCanonCaches: false sun.java.command: /home/liweigao/.emacs.d/.cache/meghanada/meghanada-1.3.1.jar -p 0 -l /tmp/meghanada_server_1000.log sun.java.launcher: SUN_STANDARD sun.jnu.encoding: UTF-8 sun.management.compiler: HotSpot 64-Bit Tiered Compilers sun.os.patch.level: unknown user.country: US user.country.format: CN user.dir: /home/liweigao/work/project/android-test user.home: /home/liweigao user.language: en user.language.format: zh user.name: liweigao user.timezone: Asia/Shanghai

Project:

project: gradle projectRoot: /home/liweigao/work/project/android-test/app gradlePrepareCompileTask: [] gradlePrepareTestCompileTask: [] projectDatbase: /home/liweigao/.cache/meghanada/app_2080c1c339e09cbb_48f02eb659cb99a3 projectDatabaseSize: 8.00MB source-formatter: google sources: /home/liweigao/work/project/android-test/app/build/generated/source/buildConfig/debug /home/liweigao/work/project/android-test/app/build/generated/ap_generated_sources/debugUnitTest/out /home/liweigao/work/project/android-test/app/src/main/java/com/example/androidtest /home/liweigao/work/project/android-test/app/build/generated/aidl_source_output_dir/debug/out /home/liweigao/work/project/android-test/app/src/main/java /home/liweigao/work/project/android-test/app/build/generated/ap_generated_sources/debug/out /home/liweigao/work/project/android-test/app/src/main/resources /home/liweigao/work/project/android-test/app/build/generated/renderscript_source_output_dir/debug/out /home/liweigao/work/project/android-test/app/src/main/res /home/liweigao/work/project/android-test/app/src/main/assets /home/liweigao/work/project/android-test/app/src/main/rs /home/liweigao/work/project/android-test/app/src/main/aidl /home/liweigao/work/project/android-test/app/src/main/jniLibs resources: /home/liweigao/work/project/android-test/app/build/generated/res/rs/debug /home/liweigao/work/project/android-test/app/build/generated/res/resValues/debug output: /home/liweigao/work/project/android-test/app/build/intermediates/app_classes/debug testSources: /home/liweigao/work/project/android-test/app/src/test/aidl /home/liweigao/work/project/android-test/app/src/androidTest/rs /home/liweigao/work/project/android-test/app/build/generated/aidl_source_output_dir/debugAndroidTest/out /home/liweigao/work/project/android-test/app/src/test/res /home/liweigao/work/project/android-test/app/src/test/assets /home/liweigao/work/project/android-test/app/src/androidTest/assets /home/liweigao/work/project/android-test/app/src/test/resources /home/liweigao/work/project/android-test/app/build/generated/source/buildConfig/androidTest/debug /home/liweigao/work/project/android-test/app/build/generated/renderscript_source_output_dir/debugAndroidTest/out /home/liweigao/work/project/android-test/app/src/androidTest/resources /home/liweigao/work/project/android-test/app/src/test/java /home/liweigao/work/project/android-test/app/src/androidTest/res /home/liweigao/work/project/android-test/app/src/androidTest/aidl /home/liweigao/work/project/android-test/app/build/generated/ap_generated_sources/debugAndroidTest/out /home/liweigao/work/project/android-test/app/src/androidTest/jniLibs /home/liweigao/work/project/android-test/app/src/test/rs /home/liweigao/work/project/android-test/app/src/androidTest/java /home/liweigao/work/project/android-test/app/src/test/jniLibs testResources: /home/liweigao/work/project/android-test/app/build/generated/res/resValues/androidTest/debug /home/liweigao/work/project/android-test/app/build/generated/res/rs/androidTest/debug testOutput: /home/liweigao/work/project/android-test/app/build/intermediates/classes/test/debug dependencies: id:junit-4.12.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/junit/junit/4.12/2973d150c0dc1fefe998f834810d68f278ea58ec/junit-4.12.jar

id:collection-1.1.0.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.collection/collection/1.1.0/1f27220b47669781457de0d600849a5de0e89909/collection-1.1.0.jar

id:core-common-2.1.0.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.arch.core/core-common/2.1.0/b3152fc64428c9354344bd89848ecddc09b6f07e/core-common-2.1.0.jar

id:constraintlayout-solver-2.0.4.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.constraintlayout/constraintlayout-solver/2.0.4/1f001d7db280a89a6c26b26a66eb064bb6d5efeb/constraintlayout-solver-2.0.4.jar

id:hamcrest-integration-1.3.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-integration/1.3/5de0c73fef18917cd85d0ab70bb23818685e4dfd/hamcrest-integration-1.3.jar

id:android.jar scope: COMPILE file: /home/liweigao/Android/Sdk/platforms/android-30/android.jar

id:javax.inject-1.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar

id:javawriter-2.1.1.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/com.squareup/javawriter/2.1.1/67ff45d9ae02e583d0f9b3432a5ebbe05c30c966/javawriter-2.1.1.jar

id:jsr305-2.0.1.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/com.google.code.findbugs/jsr305/2.0.1/516c03b21d50a644d538de0f0369c620989cd8f0/jsr305-2.0.1.jar

id:classes.jar scope: COMPILE file: /home/liweigao/.gradle/caches/transforms-2/files-2.1/69df24f507dd720395403495b7b06b0d/jetified-junit-1.1.2/jars/classes.jar

id:junit-4.13.1.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/junit/junit/4.13.1/cdd00374f1fee76b11e2a9d127405aa3f6be5b6a/junit-4.13.1.jar

id:lifecycle-common-2.1.0.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.lifecycle/lifecycle-common/2.1.0/c67e7807d9cd6c329b9d0218b2ec4e505dd340b7/lifecycle-common-2.1.0.jar

id:annotation-1.1.0.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/androidx.annotation/annotation/1.1.0/e3a6fb2f40e3a3842e6b7472628ba4ce416ea4c8/annotation-1.1.0.jar

id:hamcrest-core-1.3.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar

id:hamcrest-library-1.3.jar scope: COMPILE file: /home/liweigao/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-library/1.3/4785a3c21320980282f9f33d0d1264a69040538f/hamcrest-library-1.3.jar

meghanada-server-log打印如下:

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. [INFO ][Main : 54] use java home: /usr/lib/jvm/java-11-openjdk-amd64 [INFO ][Main : 55] use java runtime: OpenJDK Runtime Environment 11.0.9.1+1-Ubuntu-0ubuntu1.20.04 [INFO ][Main : 59] use java vm: OpenJDK 64-Bit Server VM 11.0.9.1+1-Ubuntu-0ubuntu1.20.04 [INFO ][Main : 151] Meghanada-Server Version:1.3.1-4d1e3bf WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.nustaq.serialization.FSTClazzInfo (file:/home/liweigao/.emacs.d/.cache/meghanada/meghanada-1.3.1.jar) to field java.lang.String.value WARNING: Please consider reporting this to the maintainers of org.nustaq.serialization.FSTClazzInfo WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release [INFO ][Session : 202] load project from cache. projectRoot:/home/liweigao/work/project/android-test/app [ERROR][Session : 206] Catching java.lang.UnsupportedOperationException: null at meghanada.com.google.common.collect.ImmutableCollection.add(ImmutableCollection.java:246) ~[meghanada-1.3.1.jar:?] at meghanada.project.Project.lambda$mergeFromProjectConfig$8(Project.java:771) ~[meghanada-1.3.1.jar:?] at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?] at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?] at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?] at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?] at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?] at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?] at meghanada.project.Project.mergeFromProjectConfig(Project.java:771) ~[meghanada-1.3.1.jar:?] at meghanada.project.gradle.GradleProject.mergeFromProjectConfig(GradleProject.java:594) ~[meghanada-1.3.1.jar:?] at meghanada.session.Session.loadProject(Session.java:203) [meghanada-1.3.1.jar:?] at meghanada.session.Session.findProject(Session.java:139) [meghanada-1.3.1.jar:?] at meghanada.session.Session.createSession(Session.java:111) [meghanada-1.3.1.jar:?] at meghanada.session.Session.createSession(Session.java:105) [meghanada-1.3.1.jar:?] at meghanada.server.emacs.EmacsServer.startServer(EmacsServer.java:361) [meghanada-1.3.1.jar:?] at meghanada.Main.main(Main.java:153) [meghanada-1.3.1.jar:?] [INFO ][GradleProj: 171] loading gradle project:/home/liweigao/work/project/android-test/app/build.gradle [INFO ][GradleProj: 261] detect android project app. api 3 model 4.1.2 [INFO ][Session : 230] loaded project:/home/liweigao/work/project/android-test/app elapsed:9.272 s [INFO ][EmacsServe: 366] zpage tracez handler http://localhost:52473/tracez [INFO ][EmacsServe: 372] Start server Listen localhost port:40289 [INFO ][EmacsServe: 394] client connected [INFO ][CacheEvent: 65] create class index … read 15 jars. elapsed:1.213 s [INFO ][CacheEvent: 71] start analyze sources … [INFO ][Project : 339] project app compile and analyze (java) 2 files. force:false problem:3 elapsed:795.6 ms [WARN ][CompileRes: 114] warning: [options] bootstrap class path not set in conjunction with -source 8 [ERROR][CompileRes: 112] /home/liweigao/work/project/android-test/app/src/main/java/com/example/androidtest/MainActivity.java:3: error: package androidx.appcompat.app does not exist import androidx.appcompat.app.AppCompatActivity; ^ [ERROR][CompileRes: 112] /home/liweigao/work/project/android-test/app/src/main/java/com/example/androidtest/MainActivity.java:7: error: cannot find symbol public class MainActivity extends AppCompatActivity { ^ symbol: class AppCompatActivity [INFO ][Config : 139] analyzed and compiled. elapsed:1.276 s [INFO ][CacheEvent: 88] class index size:10663 total elapsed:2.495 s [INFO ][Config : 202] memory usage (used/total/max): 213.00MB / 376.00MB / 3948.00MB [INFO ][CacheEvent: 94] Ready [INFO ][EmacsServe: 354] receive [sp]. 12.03 ms [WARN ][JavaSource: 77] source cache miss /home/liweigao/work/project/android-test/app/src/main/java/com/example/androidtest/MainActivity.java [INFO ][EmacsServe: 354] receive [sd, /h/l/w/p/a/a/s/m/j/c/e/a/MainActivity.java, 7, 1, public]. 37.81 ms [INFO ][EmacsServe: 354] receive [sd, /h/l/w/p/a/a/s/m/j/c/e/a/MainActivity.java, 7, 34, extends]. 17.82 ms [INFO ][EmacsServe: 354] receive [sd, /h/l/w/p/a/a/s/m/j/c/e/a/MainActivity.java, 7, 37, AppCompatActivity]. 626.5 μs [WARN ][Session : 818] missing location path=/home/liweigao/work/project/android-test/app/src/main/java/com/example/androidtest/MainActivity.java line=7 column=37 symbol=AppCompatActivity [INFO ][EmacsServe: 354] receive [jd, /h/l/w/p/a/a/s/m/j/c/e/a/MainActivity.java, 7, 37, AppCompatActivity]. 7.293 ms [WARN ][Session : 818] missing location path=/home/liweigao/work/project/android-test/app/src/main/java/com/example/androidtest/MainActivity.java line=7 column=37 symbol=AppCompatActivity [INFO ][EmacsServe: 354] receive [jd, /h/l/w/p/a/a/s/m/j/c/e/a/MainActivity.java, 7, 37, AppCompatActivity]. 1.427 ms [INFO ][EmacsServe: 354] receive [pc, /h/l/w/p/a/a/s/m/j/c/e/a/MainActivity.java]. 567.3 μs

请用一句完整的陈述句/疑问句作为标题,差一两个字或标点符号,意思差别很大:

- spacemacs使用meghanada打开android gradle工程
+ spacemacs使用meghanada打开android gradle工程出错

已修正,多谢指点

应该不会,meghanada 给的例子就是两个文件同时存在:

https://github.com/mopemope/meghanada-server/blob/master/docs/configuration.md#android-studio-project