6

I believe Scala and Java can use classes from each other.

However, I found myself in a situation that my Java class cannot use a Scala class in the same package.

The scala class is defined as:

class CustomerService extends AbstractCustomerService {

The code trying to use this bit of code is:

public Deployer() {
        singletons.add(new CustomerService());
}

The error I got is:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3:compile (default-compile) on project orderservice: Compilation failure
[ERROR] \devel\raven\services\orderservice\service\src\main\scala\com\mxyy\orderservice\customer\Deployer.java:[12,31] cannot find symbol
[ERROR] symbol  : class CustomerService
[ERROR] location: class com.mxyy.orderservice.customer.Deployer

Can someone give me some hint about this?

Many thanks

3
  • 5
    Are your other Scala classes visible in Java? This sounds more like a Maven issue. Commented Feb 21, 2012 at 16:16
  • Thanks for your reply. What do you mean visibie? How to configure Maven to make it visible? Commented Feb 21, 2012 at 16:55
  • The exact solution is here: [stackoverflow.com/questions/8046422/… answered by: Thomas Eilermann [1]: stackoverflow.com/questions/8046422/… Commented Oct 9, 2014 at 10:19

1 Answer 1

9

configure your pom.xml according to this article: joint compliation of scala and java sources

Sign up to request clarification or add additional context in comments.

1 Comment

this should be in the maven Scala archetype

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.