Your Location is: Home > Eclipse

How to fix the error “test source folder 'src/test/java' in project 'mahout-flink_'must have an output folder that is not also used for main source”?

From: Romania View: 1171 M.Mulualem 

Question

I have installed mahout and I have imported the existing maven project 'apache-mahout-distribution-0.12.2' to Eclipse IDE for Java Developers and can not build and I couldn't fix the these problems .Please share me your knowledge!. Thank you!

Best answer

I had similar issue and had to type-in the name of the output folder directly in the .classpath as follows

<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>

Note that 'contains test source' on Java Build Path panel should be set to 'Yes'. Once I did that and refreshed the output became visible in the Java Build Path panel.

Another answer

I had the same problem a couple of minutes ago. I tried some options as listed below and nothing happened:

  • Changing the output folder specific for test class
  • Changing the option 'Contains test sources' from no to yes and vice-versa
  • Excluding all source folders on build path

My solution: I removed the project from my workspace and a new one was created.

enter image description here

enter image description here

Furthermore infomation about Test Source configuration at Eclipse, https://www.eclipse.org/eclipse/news/4.8/jdt.php

Another answer

Surely it will be enough to open project's Java Build Path, focus the src/test/java folder and set its output folder as <project>/target/test-classes.