This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I work in a team. We have a division of labor arrangement. Under our project, each developer is assigned a sub-task. Each sub-task receives some input parameters from its upstream sub-task and generates some outputs for the downstream sub-task.
All developers first work indepently. Each of us has our own folder in the Repository. Each of us makes an assumption on the values of the input parameters received. (We later on integrate all sub-tasks.)
I generate my Java classes under a folder called "Orchestrator", and I access some classes under the folder called "common". Things go smoothly.
Thereafter, I start accessing other folders. I first retrieve other folders from the Repository and then in the Eclipse Package Explorer View --> import --> Import Existing Maven Projects ... No problem. I have all other folders in the Package Explorer View.
However, when I start adding the import statements in my Java classes to access classes in other folder; for example,
I have the compilation error:
The import company_name.overall_project_name.project_name.folder_name cannot be resolved
First, I have no problem to access the "common" folder. The code I have below does not have compilation error and I am able to use the class that is imported:
Second, I have checked the consistency of path and folder name.
Since you are creating a Maven project, you need to add a dependency to your pom.xml for the artifact that includes the "company_name.overall_project_name.project_name.folder_name.subfolder_name.class_name" class.
In other words, each project must create an artifact which goes into a central Maven repository (you do have one of those, right?), and each project must list in its pom.xml the artfiacts of the projects on which it depends.