简体   繁体   中英

.classpath file in the eclipse question

In the eclipse directory, there is .classpath file. What's the purpose of this file? I have ant build.xml available, why Eclipse still need its own?

Eclipse has its own mechanism for building your project. The .classpath file contains information that the IDE uses to create the classpath used at build-time, runtime etc. You can directly edit this file if you want but it is created by the IDE based on the settings that you provide via the project properties dialog.

There is Ant integration within Eclipse insofar as it provides you a specific editor for build files, but it can't use any of the information in the build file for its own builders. Ant files are custom, so there is no way Eclipse could know what info to use.

The reason for this is that it doesn't matter if you have an Ant file or not. The reason for the presence of this file is that this is a Java Project, and the corresponding Project nature always generate such a file. Create a normal Project (New->Project->General->Project) and you'll see that there is no .classpath file. In general I would recommend to split those functionalities in separate projects, that means one Java Project for developing, one non-Java-Project for executing your Ant scripts.

HTH Tom

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM