Adding a Package to the Java Project Structure

I am working on a project locally, and at some point I gave the project to someone else I was working on. Since then I have created another package with classes and so on in my own version of the project. Since I want another person to have this package, I gave him a folder with a folder that he copied in the path of ProjectName / src / packageName. Of course, he did not immediately understand, so I used New-> Source Folder and updated / cleared / prayed to make it work.

Question: is there any other way to add packages to projects? as I'm not sure if this is the right solution.

+6
source share
4 answers

An update is enough after you drop the new source files inside the source folder. No need to add a new source folder.

A clean way to work together is to use a version control system such as Subversion, git, or something else. Copying files between developers is a recipe for chaos.

+13
source

From the backend, go to ProjectName / src and copy / paste the whole package, and then right-click and select "Update".

+3
source

Just deleting files and updating is enough. Eclipse automatically modifies the package declaration in Java sources.

With everything said, you should look at using a version control system, such as CVS or subversion.

+1
source
  • Copy the folder to the desired location.
  • Update the project in eclipse. Now it will be seen.
  • Right-click on the folder in eclipse in the explorer project. Select Build Path> Use as Source Folder.
+1
source

Source: https://habr.com/ru/post/915966/


All Articles