Eclipse support for multiple Java projects is not friendly!

Source: Internet
Author: User

This article spits Groove!

If we create a two Java project. One called Statsreader. Download data from the Web to your local database. One called Statsviewer. Take the data out of the database and present it to the user. All two of these projects will be mysql-connector-java-5.0.8-bin.jar with the same external class library.

Eclipse is able to create a working set. Contains multiple Java projects, but the working set is just a concept, regardless of where the project is actually stored.

But we can put two items in the same folder, such as D:\Source Code\nba\statsreader and D:\Source code\nba\statsviewer.

If there is a requirement, reader is asked to open the viewer on its own initiative after reading the data. We can use the change. project file to add a linked directory to the Statsreader compile location from D:\Source code\nba\statsreade\bin to D:\Source code\nba\bin, i.e.: \ bin. The same statsviewer also moves like this.

Java compilation Rotten on the file level of the source code and the binary, I have a.java. It is made up of a.class. So, in case Statsreader and Statsreader have a file name, there will be an error.

I came from C #, in Java I used to include the main function of the file named Program.java, so there are Statsreader/program.java and Statsviewer/program.java. After compiling the bin will only have a program.class, I do not know whether it is reader or viewer!

That's fine. Fortunately I can also package Java programs into jars.

For example, I reader first debug, packaged into Statsreader.jar, put in the bin. Then start debugging the viewer.

As Reader Program.class in the bin, I clicked Execute in the Eclipse Viewer project. Actually, it's reader!.

I'm going to compile reader again, no!

Say you want to clean up the project state and compile. Cleanup project status In fact, all the files in the bin have been cleared, I just packed the Statsreader.jar!

Visual Studio support is much better! VS Create a project, this project is on its own initiative in a solution, from the beginning to tell you a solution can include multiple projects. Without a special look, I wouldn't know that Eclipse has a working set.

VS can force the project to be compiled again. No matter if the code file has been changed, it will be compiled for you again. VS is also able to clean up the solution, almost the same as the Eclipse Cleanup project status. But vs it's not a whole brain to delete the file in the bin directory, it simply deletes the file it generated.

Like the two projects I've just described, I think it's very good to do in vs. Clear structure. Simple management.

Some people are unconvinced, saying that Eclipse has Ant's own initiative to build the Great God, as well as the Maven great God, gradle God, but I this is simply the need to use to have a special technology? The Eclipse menu has options like Ant's own initiative, but how do I know what that means?

I don't know if eclipse can perform the pre-build Action, post-compilation action, which seems to be Ant's responsibility. Can not compile to D:\Source code\nba\statsreade\bin. Packaged into jars to D:\Source code\nba\bin, execute D:\Source code\nba\bin jar? It seems that you have to understand your own initiative to build!

VS compiled pre-compilation action is very obvious, in the project Properties form, a few points can be seen. Although the post-compilation actions are self-building, VS does not introduce this concept, I directly see what I want to use. Unconsciously. "This is the initiative to build their own ah." "VS also supports copying non-code files to the compiled folder after compilation.

In my example, both reader and viewer are connected to the database, and I want to put the connection string in a file, such as Connection.txt, with two programs in the sibling folder.

Because of the problem of cleaning up the project status above. This txt is often erased. It's convenient in VS, TXT is put together with code, but set to compile and copy to the compiled folder. That's it.

I don't know if there's any kind of self-motivated build tool like Ant God, but its csproj file has some programming power.

The conclusion is. Visual Studio is more useful than eclipse!

Welcome to shoot Bricks.

Eclipse support for multiple Java projects is not friendly!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.