varun
varun

Reputation: 726

Maven multimodule projects linking in eclipse

I have a maven multi module project which has 5 modules. Some of my modules depend on one or more other modules, I am successfully able build the project and in eclipse also I am not getting any errors. However there is one problem which is bothering me, when i ctrl + click in my code and the class is defined on some other project eclipse does not open the file in the editor. I know i can attach the source code using maven but still i wont be able to make changes to that file. Is there any way to be able to link projects in eclipse through maven?

Upvotes: 0

Views: 975

Answers (3)

mediahype
mediahype

Reputation: 500

Is there any way to be able to link projects in eclipse through maven?

That behaviour is the default. To check if for some reason that default is not in effect for your project, right click your project (the project you want to jump from) and go to "Maven". If there is an option "Disable Workspace Resolution" the workspace resolution is switched on, meaning you can theoretically jump from that project.

If you still cannot jump, then the project you want to jump to is not in your workspace. Take into account that for eclipse to identfy one project as dependency of another, everything including version must match.

Also check what rest_day said. You must have the projects importet as maven projects, but running eclipse:eclipse is not required anymore with current (up to ca 2 year old) eclipse.

Upvotes: 1

Aaron Digulla
Aaron Digulla

Reputation: 328614

Instead of Ctrl+Click, click on the identifier and press F3. If you now see a red text reading "Current text selection cannot be opened in an editor", you've been hit by this bug.

See this question for a solution: How do I get rid of "Current text selection cannot be opened in an editor" in Eclipse?

Upvotes: 0

rest_day
rest_day

Reputation: 858

Did you import the projects as Maven projects?

Also, could you go to the root of the project and run mvn eclipse:eclipse

eclipse:eclipse

Full name:

org.apache.maven.plugins:maven-eclipse-plugin:2.10:eclipse

Description:

Generates the following eclipse configuration files:

.project and .classpath files .setting/org.eclipse.jdt.core.prefs with project specific compiler settings various configuration files for WTP (Web Tools Project), if the parameter wtpversion is set to a valid version (WTP configuration is not generated by default)

If this goal is run on a multiproject root, dependencies between modules will be configured as direct project dependencies in Eclipse (unless useProjectReferences is set to false).

Upvotes: 0

Related Questions