Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin test projects should not use "target/test-classes" in .classpath #2498

Closed
LorenzoBettini opened this issue Jun 11, 2021 · 3 comments · Fixed by #2869
Closed

Plugin test projects should not use "target/test-classes" in .classpath #2498

LorenzoBettini opened this issue Jun 11, 2021 · 3 comments · Fixed by #2869

Comments

@LorenzoBettini
Copy link
Contributor

Currently, the Xtext wizard generates plugin test projects (e.g., .tests and .ui.tests) with source folders set as test source folders (correct!) but in the .classpath the output folder is set as target/test-classes. I think this wrong, especially when such projects are build with Maven/Tycho (which is usually the case for plugin test projects): Tycho ignores such setting and always generates .class files into target/classes (NOT target/test-classes). After all, plugin test projects are meant to contain only test code, so there's no risk of mixing main and test code (they'll be in different projects). Moreover, with the current settings in the .classpath, Eclipse will generate .class files (of tests) in target/test-classes while Tycho will generate it in target/classes. If you run the Maven/Tycho build from your Eclipse workspace you'll end up with duplicated .class files for tests (in target/classes and in target/test-classes), leading to possible strange errors during tests (e.g., removed test cases are still executed, or removed test methods are still executed).

I'd propose to generate .classpath files with output target/classes for plugin test projects.

I can provide a PR.

@cdietrich
Copy link
Member

cdietrich commented Jun 21, 2021

am not sure if this is coming from tycho, from tycho m2e or whatever.
the test-classes might be there for a reason.
we also may have to distingish between maven and maven tycho.

@ArneDeutsch do you remember why it is done as its currently done (org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator.configureJavaProject(ProjectDescriptor, JavaProjectFactory))

@LorenzoBettini
Copy link
Contributor Author

If I understand correctly from the generator, test-classes is perfectly fine for pure Maven projects (well, it's actually required, since you have main and test code in the same projects in a typical Maven project), but it's not ideal for Tycho projects (since tests are in a separate plug-in project), and there's no check in the generator under that respect.

@cdietrich
Copy link
Member

then we should fix that

@cdietrich cdietrich transferred this issue from eclipse/xtext-eclipse Apr 17, 2023
@LorenzoBettini LorenzoBettini changed the title Plugin test projects should not use "target/classes" in .classpath Plugin test projects should not use "target/test-classes" in .classpath Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants