How to change pom.xml so that Scala can access java methods and viceversa

Viewed 24

I have a project with both scala and java sources. When using intellij --the java sources are able to access Scala sources and viceversa. However when doing maven clean install I get the error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project spark: Compilation failure
[ERROR] /Users/username/proj/projectFOlder/spark/src/main/java/com/company/services/AbstractX.java:[3,37] package com.company.scalacommon does not exist
[ERROR] 
[ERROR] -> [Help 1]

I suppose this is because when java is being compiled the scala packages are not yet compiled. However, it should be noated that scala is already calling java packages.

So the question is is there a way for scala objects/ classess to access java objects/ classess and vicerversa.

I am currently using Spark scala with maven. (Java - 1.8; Scala 2.12; net.alchim31.maven ; scala-maven-plugin)

0 Answers
Related