• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My Project Cannot Import Other Maven Projects

 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Can anybody give me a clue? Thank you.



 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic