Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » In a Tycho build, ScalaTests don't run and Java-based JUnit tests don't find any Scala references
In a Tycho build, ScalaTests don't run and Java-based JUnit tests don't find any Scala references [message #1755038] Mon, 27 February 2017 05:57
Eclipse UserFriend
I now set up a POM-less Tycho build, and have a fragment that contains some tests.

I set up the ScalaTests to run with the JUnitRunner like this:

@RunWith(classOf[JUnitRunner])
class MyTest extends FlatSpec with Matchers {

  // Test code
}


I added the respective inclusions into my pom.xml (despite it's pom-less, for tests to run, a pom.xml is needed):

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>com.mycompany.myapp.project.model_test</artifactId>
    <packaging>eclipse-test-plugin</packaging>
    <parent>
        <groupId>com.mycompany.myapp</groupId>
        <artifactId>com.mycompany.myapp.tests</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>0.26.0</version>
                <configuration>
                <includes>**/Test*.java,**/*Test.java,**/*TestCase.java,**/Test*.scala,**/*Test.scala,**/*TestCase.scala</includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


When I run the build, I get:

Root exception:
java.lang.RuntimeException: Unable to create test class 'com.mycompany.myapp.tests.MyTest.scala'
...
Caused by: java.lang.ClassNotFoundException: com.mycompany.myapp.tests.MyTest.scala


I can run the test from Eclipse just fine by right-clicking the test and using the appropriate option in the "Run As" menu.

When removing the Scala inclusions and adding a simple Java-based test:

import org.junit.Test;

public class FooTest {

    @Test
    public void foo() {

    }
}


this works.

However, when I try to access anything written in Scala, it cannot resolve the references.

What am I missing?
Previous Topic:Eclipse Mars and Linux Fedora 25
Next Topic:Eclipse NEON SAP BI Modeling issues
Goto Forum:
  


Current Time: Tue Mar 18 01:06:08 EDT 2025

Powered by FUDForum. Page generated in 0.03854 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top