Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use Scala class in Java

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

like image 263
Kevin Avatar asked Feb 21 '12 15:02

Kevin


1 Answers

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

like image 85
ryskajakub Avatar answered Sep 18 '22 01:09

ryskajakub