I think you are actually using maven and the test dependencies are automatically set to be "Visible only for test sources" as part of m2e's "Maven Dependencies" classpath container.
If updating the .classpath
files ( by right-clicking on the project and choosing "Maven" > "Update Project") isn't an option for you, you can downgrade the m2e-plugin by uninstalling it and installing an older version from http://download.eclipse.org/technology/m2e/releases/ (I've verified that 1.8.3.20180227-2137 works).
Update: In m2e 1.9.1, which you can install in Eclipse Photon by using "Check for Updates" and which is included in Eclipse 2018-09 (successor of Photon), you can disable test classpath separation by setting the maven property m2e.disableTestClasspathFlag
to true
.
You can do that either on the project level by setting it in the individual pom.xml
files or for the full workspace by adding it as a property of an active profile in a user settings.xml
.
If you don't have a user setting.xml
yet, create one with the following content and select it in Eclipse in Preferences > Maven > Users Settings
as User Settings
. Then right-click on the projects and choose "Maven" > "Update Project" for all projects.
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>default</id>
<properties>
<m2e.disableTestClasspathFlag>true</m2e.disableTestClasspathFlag>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
</settings>