Module Dependency in Intellij- not able to reference Classes from other Projects - spring

I need to use a java class from project A in Project B. I believe I wrote the package and import successfully but I still get a message when compiling (./gradlew clean build) saying:
java:3: `error: package x.x.x.x.x.common.api.filter does not exist`
Next, I tried to create a module dependency within IntelliJ, by importing the new package as a Module and rewriting the package and import statement to reflect the imported package (module dependency) but I am still seeing the same error.
java:3: error: package x.x.x.x.x.common.api.filter does not exist
Would this be an issue with the build.gradle file? Or my setting up of the module dependency?
How can I resolve?

The problem is with build.gradle configuration and is not related to the IDE.
You should define the dependencies between the projects as described in Gradle documentation.
Another possible solution is Composite Builds.

Related

Maven doesn't recognize dependencies added in IntelliJ project structure

I need to use external dependencies for tomcat. I add them to project structures and project build fine. Compiler doesn't show any errors
project structure
The project works fine when i run it on IDE.
The problem starts when I try to build WAR file using Maven package :
package org.apache.catalina does not exist
package org.apache.catalina.connector does not exist
package org.apache.coyote does not exist
I've try with all different scope settings but jars aren't found

jdk9 maven compilationa error: module reads package from both A and B

maven compilation error:
module 'my.demo' reads package 'springfox.documentation.service' from both 'springfox.core' and 'springfox.spi'
Is it possible to solve split package problem from dependencies?

Gradle: Can't resolve a variable that has to be included in external dependency

This question follows this post: Gradle: Where are external dependencies stored?.
I want to use MongoDB driver for Java, so I added the following line:
compile 'org.mongodb:mongodb-driver:3.4.0'
to build.gradle file. After finishing the build successfully, I found the jar file of the dependency in ~/.gradle/caches/modules-2/files-2.1/org.mongodb.
I also added the path ~/.gradle to external libraries.
However, when I write the statement
import com.mongodb.MongoClient;
inside my project, I get an error:
"Can't resolve symbol 'mongodb'".
Do you know how to resolve this issue?
Now IJ searches in .gradle for classfiles. Of course mongodb is not found in there. As I said in the comment of the other issue, if you change the dependencies in your Gradle file and did not enable auto-import when you imported the Gradle project into IJ, its library configuration will not automatically update. Either tell IJ manually to refresh the library configuration from the Gradle file or activate auto-import so that it automatically sees when you change the Gradle file and automatically updates the library configuration.
Make sure you opened the project as Gradle project
When you add dependency, press on the sync dependencies button

Sonarqube showing class not found error when building a multi module project

I have a multi module project, and when I run Sonarqube task it shows
Could not find class xxx.xxx.xxx, due to: java.lang.NoClassDefFoundError: yyy/xxx/zzz
error.
Which is due to I use providedCompile instead of compile in gradle which cause the class source that has dependencies on another module to not compiled into build/classes/main folder.
Is there a way to point the source or copy the source over to that particular module?

compile exception in playframework code

I have recently configured an existing playframework project on my eclipse but I am getting a compile time exception classes like
import controllers.playtemplate.security.SecuredUser;
import controllers.playtemplate.security.WebsealSecure;
Can you please let me know what maven dependency would be required for this module of playframework so that i can get the code compiled?
I was able to resolve this issue by running the following command
play run -DrunEnv=local

Resources