C # SLN file-based approach in Eclipse (Java)

How does Eclipse work excluding Java files in a project?

In C #, the list of files in a project is handled in a sln file. There is nothing similar in Eclipse.

Any ideas?

+2


source to share


3 answers


In Visual Studio files, C # files are stored in .csproj files. Solutions are just containers for projects (which can be C # / C ++ / VB / ... projects).

The last time I worked with Eclipse, all files under the project root were automatically included. When one of these was excluded from the build, the project file was changed .classpath

:



<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry excluding="ExcludedFile.java" kind="src" path="src"/>
  <!-- ... other entries ... -->
</classpath>

      

You can exclude a file in Eclipse by right-clicking it in Package Explorer

and then selecting Build Path -> Exclude

.

+3


source


Project-specific metadata (like this) is stored in either .project or..classpath at the root of the project. They are hidden in the project view, but visible in the navigator view.



+1


source


You will not need to directly edit the .project and .classpath files mentioned in other answers. As with Visual Studio, the IDE creates and owns these project metadata metafiles for you.

For example, you can exclude an individual java file from the build path by right-clicking it in the project explorer and choosing Build Path / Exclude. This will make the necessary changes to the .classpath for you.

-1


source







All Articles