Thanks for the reply, the problem is indeed with the project dependencies. After reading the link Emmanuel Comba mentioned in Sonar Rule: Symbol and SymbolType always unknown, I learn that the project being scanned provide the environments, therefore, it was able to detect all the methods that I was looking for. However, in test environment (and the results/failures kinda similar to SonarLint x SonarQube integration), I have to provide the the dependencies myself. Otherwise, it wouldn’t recognize SharedPreference, Context, or even String:
12:10:35.416 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for javax
12:10:35.416 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for javax.crypto
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for StringBuilder
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.package-info
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$StringBuilder
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for String
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$String
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for String
12:10:35.523 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$String
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for SharedPreferences
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.SharedPreferences
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$SharedPreferences
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for StringBuilder
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$StringBuilder
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for Context
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Context
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$Context
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for Context
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Context
12:10:35.538 [main] DEBUG o.s.j.b.loader.SquidClassLoader - .class not found for java.lang.Synthetic$Context
I’m planning to find a way to build all those artifacts and put them under
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>test-compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
all the dependencies go here
If you have any cleaner or alternative solutions for this, please advise. I really appreciate any help about this issue as my solution is kinda a brute-force attempt and require more artifacts to be added as I go.
Another summary of the issue: