Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

These instructions describe how to load OpenMRS into Eclipse version 3.4.2 using the Maven Eclipse Plugin. Eclipse and Maven are assumed to be installed previously.

[edit]

Setup Eclipse Workspace for Maven

Run the follow command from the command line at the root of the SVN checkout:mvn eclipse:configure-workspace -Declipse.workspace=<path-to-eclipse-workspace>[edit]

Start Eclipse using the Configured Workspace

On starting Eclipse, select the <path-to-eclipse-workspace> used in the previous step. If Eclipse is already started, switch the workspace by File -> Switch Workspace -> Other... and select the workspace pathworkspace path.

http://archive.openmrs.org/wiki/Image:SelectWorkspace.JPGImage Added

  • Verify the workspace is configured properly by going to Windows -> Preferences.
  • Java -> Build Path -> Classpath Variables should contain a variable named M2_REPO.
  • Java -> Code Style -> Formatter should have the Active profile of 'OpenMRS Formatter'

[edit]

Setup Maven commands in Eclipse

Maven commands can be setup in Eclipse as External Tools by Run -> External Tools -> External Tools Configurations... -> Program -> New.

http://archive.openmrs.org/wiki/Image:ExternalToolsMvnEclipse.JPGImage Added

The Maven executable path should be entered as the Location either as the full path or as a variable. To create the variable, select Variables... -> Edit Variables... -> New... Enter a name with the value being the path to the Maven executable bin/mvn

http://archive.openmrs.org/wiki/Image:ExternalToolsMvnVariable.JPGImage Added

Select the newly created variable name for the Location, and enter the path to the OpenMRS svn checkout as the Working Directory. Enter the Arguments for the eclipse command:eclipse:eclipse --batch-mode -DdownloadSources=true

Refresh the workspace after running the commands by selecting the Refresh tab and 'Refresh resources upon completion'

http://archive.openmrs.org/wiki/Image:ExternalToolsMvnRefresh.JPGImage Added

Apply the External Tools changes and Run. Output from the command with appear in the Console. After running, the Maven tools are available in the External Tools dropdown.

http://archive.openmrs.org/wiki/Image:ExternalToolsDropdown.JPGImage Added

Follow the same steps for adding other Maven commands. For the build command, enter these the Arguments:clean install --batch-mode http://archive.openmrs.org/wiki/Image:ExternalToolsMvnBuild.JPG

[edit]Image Added

Generate Eclipse Projects

...

Each time the dependencies are changed in the pom.xml, re-run this command to update the libraries in Eclipse.[edit]

Import Projects in Eclipse

Import the generated Eclipse projects by File -> Import... -> General -> Existing Projects.

http://archive.openmrs.org/wiki/Image:ImportProjects.JPGImage Added

Browse to the location of the OpenMRS svn checkout and select the three OpenMRS projects (api, web, webapp)

http://archive.openmrs.org/wiki/Image:ImportProjects2.JPG

[edit]

Image Added

Update Eclipse View

A suggestion is to use the Java perspective with the Referenced Libraries node. Change the perspective by Window -> Open Perspective -> Java

http://archive.openmrs.org/wiki/Image:ViewJava.JPGImage Added

Set the Referenced Libraries node by selecting Show 'Referenced Libraries' Node

http://archive.openmrs.org/wiki/Image:ViewLibraries.JPGImage Added