`
lan13217
  • 浏览: 495942 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

Using the M2Eclipse Maven Plugin In Eclipse

 
阅读更多

http://archive.openmrs.org/wiki/Using_the_M2Eclipse_Maven_Plugin_In_Eclipse

 

https://wiki.openmrs.org/display/docs/Using+the+M2Eclipse+Maven+Plugin+In+Eclipse#UsingtheM2EclipseMavenPluginInEclipse-HowtoRunWebApplication

 

 

Requirements
  • Eclipse 3.4+
  • Apache Maven 2.2.1 or later
  • M2Eclipse plugin
Table of Contents
  • Checkout Source and Create Project
  • Develop with Maven
  • How to run the build
  • How to run Junit
  • How to Run Web Application
  • How to Profile Web Application with YourKit
  • How to Debug Web Application
  • JVM Hotswap
  • Hot Deploy
  • Use JRebel

Checkout Source and Create Project

  1. File → New → Project → Checkout Maven Projects From SCM

  1. For SCM, choose 'svn' and browse to the project (http://svn.openmrs.org/openmrs/trunk )

  1. In older versions of the m2eclipse Eclipse plugin (prior to 0.11.0), you have an option to place all modules within a single project; this feature is deprecated as of m2eclipse 0.11.0 .
    Click Advanced, and uncheck "separate projects for modules" (if that doesn't exist, change m2eclipse setting in Window → Preferences → Maven → Support multiple maven modules)
  2. Click Finish to download and create the Maven project(s).

Develop with Maven

There are five projects shown in the workspace: openmrs, openmrs-api, openmrs-test, openmrs-tools, openmrs-web, and openmrs-webapp. The openmrs project is a parent project. When we run any maven goal on the parent project, it will run the same goal on its children, according to the dependency order. A Maven menu item is added on the context menu, which lets you modify the pom.xml, manage dependencies and plugins, etc. Common maven goals are also added on the menu items Run As and Debug As . You can also create your own Maven Run Configurations.

How to run the build

  • Right click the openmrs project to bring up the context menu, select "Run as → Maven build..." (notice the "..." at the end)

  • Enter the Goals: clean install
  • Make sure the Maven Runtime at the bottom is correct for your installation (Configure for Embedded/External as necessary)
  • Select Apply, then Run

  • The build output will be displayed in the Console.
  • The output contains links to the results of each test.

To re-run the build, right click the root project to bring up the context menu, select "Run as -> Maven build."  If you have multiple configurations, select the "clean install" one to run.

To manage these configurations, right click the root project to bring up the context menu, select "Run as -> Run configurations...".  Select the configuration under the Maven Build section.

How to run Junit

If you want to run all tests across modules, select Openmrs project and right click to bring context menu, select "Run As → Maven test"

If you want to run all tests in one module, select that project and right click to bring context menu, select "Run As → Maven test"

If you want to run a single test class,right click on test class and select "Run As → Junit test"

How to Run Web Application

Create a run configuration by click "Run → Run Configurations", select Maven Build and click "New launch configuration", type Name "OpenMRS", select working directory to be the root of webapp project, type goal "jetty:run" and save. Now you select "OpenMRS" and run or debug it.

On the JRE tab, in the VM parameters box, you will want to put in your memory parameters, e.g.

-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:NewSize=128m

See Troubleshooting Memory Errors  or Performance Tuning  or Increasing Memory for Maven

Current configuration of Jetty is that it will reload static resources like jsp, javascript files etc. If there is any java class change, It will require to run maven:compile goal (if auto build is not enabled) and restart Jetty.

How to Profile Web Application with YourKit

Set up a run configuration as specified in "How to Run Web Application" but in the JRE tab, set the -agentpath VM option as specified in the YourKit docs . Common values:

  • Linux x86, 32-bit Java: -agentpath:<profiler directory>/bin/linux-x86-32/libyjpagent.so
  • Mac OS X: -agentpath:<profiler directory>/bin/mac/libyjpagent.jnilib
  • Windows, 32-bit Java: -agentpath:<profiler directory>\bin\win32\yjpagent.dll

(This assumes you have YourKit installed already.)

How to Debug Web Application

Jetty plugin can pick up any changes of static resources, so changes of jsp, property or css files don't require a restart. However changes of java class will have to restart. The following solutions could help in some situations.

JVM Hotswap

Not yet documented.

Hot Deploy

Not yet documented.

Use JRebel

Here is how you configure JRebel to work with OpenMRS

  1. Download JRebel and install it. http://www.zeroturnaround.com/jrebel/current/
  2. Install JRebel plugin for Eclipse and restart.
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel1.jpg
  3. Configure JRebel plugin for Eclipse.
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel2.jpg
    Specify location of JRebel installation
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel3.jpg

Tick "Use Step filters" and also add com.zeroturnaround.* and org.zeroturnaround.* to the filters Tick "filter synthetic fields"

  1. Configure JRebel Agent Setting provided by JRebel installation
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel4.jpg
    Untick "Spring Framework Plugin"
  2. Change "OpenMRS" Run configuration to increase Permgen and enable JRebel.
    http://archive.openmrs.org/wiki/Image:Eclipse-jrebel5.jpg
  3. Run or Debug "OpenMRS"

When you change any java classes, just wait for eclipse auto build to finish, reload the web page, and JRebel will reload the class for you.

分享到:
评论

相关推荐

    eclipse maven plugin 插件 安装 和 配置.docx

    ### Eclipse Maven Plugin 插件安装与配置指南 #### 一、引言 在现代软件开发过程中,Maven作为一款强大的构建工具,极大地简化了项目的构建流程。为了更好地集成Maven的功能,Eclipse提供了名为Eclipse Maven ...

    m2eclipse maven插件

    m2eclipse不仅支持Maven的标准生命周期,还可以与许多第三方Maven插件配合,如maven-compiler-plugin、maven-surefire-plugin等,使得在Eclipse中可以便捷地使用这些插件的功能。 8. **集成Eclipse特性** m2...

    m2eclipse eclipse maven插件

    **m2eclipse:Eclipse的Maven集成插件** m2eclipse是Eclipse集成开发环境(IDE)中的一个非常重要的插件,它将Apache Maven的构建和项目管理功能无缝地整合到了Eclipse中。Maven是一个强大的项目管理和依赖管理工具...

    eclipse maven3 plugin.zip

    直接离线安装eclipse中的maven插件,在你的eclipse安装根目录下创建两个文件夹:links,myplugins(文件夹名字可以自定义),所在路径D:\eclipse。将下载下来的maven插件放到myplugins下。载links目录下创建一个...

    ECLIPSE MAVEN3插件文件(eclipse-maven3-plugin工具)

    ECLIPSE MAVEN3插件文件(eclipse-maven3-plugin工具)

    eclipse-maven3-plugin

    **eclipse-maven3-plugin** 是一个专门为 Eclipse IDE 设计的插件,它允许开发者在 Eclipse 开发环境中无缝集成 Maven 构建工具。Maven 是一个项目管理和综合工具,广泛用于 Java 应用程序的构建、依赖管理和项目...

    eclipse-maven-plugin

    "Eclipse Maven Plugin" 是一个专门为Eclipse集成开发环境设计的插件,它使得在Eclipse中管理和构建Maven项目变得更为便捷。Maven是一个广泛使用的项目管理和综合工具,它通过配置文件(pom.xml)来管理项目的依赖、...

    maven-eclipse-plugin

    【maven-eclipse-plugin】是Maven生态中的一个重要插件,它主要负责将Maven项目导入Eclipse这样的IDE中,以便于开发人员进行便捷的开发和管理。在使用Maven时,理解并熟练掌握这个插件的使用对于提高开发效率至关...

    eclipse-maven3-plugin Maven插件离线安装包

    eclipse-maven3-plugin.7z 解压缩到 plugins 目录下 3. 在 links 目录下创建一个maven.link(名字可以随便取,但必须是.link结尾的文件)文件 打开并输入:path= D:/Development/eclipse-JavaEE/eclipse/plugins...

    eclipse-maven3-plugin.zip

    Eclipse Maven3 插件,通常被称为 m2e(Maven Integration for Eclipse),是Eclipse IDE中的一个核心组件,用于支持Maven构建工具的集成。这个插件使得开发者能够在Eclipse环境中无缝地管理Maven项目,包括构建、...

    eclipse的maven插件m2eclipse 1.6.2 目前最新版

    Eclipse的Maven插件m2eclipse是开发人员在集成开发环境中管理Maven项目的重要工具。m2eclipse 1.6.2是该插件的一个特定版本,旨在提供更好的性能、稳定性和功能增强。以下是对这个插件及其版本的详细解释: 一、m2...

    m2maven is a plugin for maven

    Note about 0.9.8 Workspace Incompatibility: If you are using m2eclipse 0.10.0 with a workspace that contains projects created under m2eclipse 0.9.8, you must remove the workspaceState.ser file....

    maven-eclipse_plugin.zip

    【Maven Eclipse Plugin详解】 Maven Eclipse Plugin是Apache Maven项目的一部分,它主要负责将Maven构建过程与Eclipse IDE集成,使得开发人员能够在Eclipse环境中方便地管理Java项目的依赖、构建以及生命周期。这...

    最新Eclipse( SVN m2eclipse Maven3.0 Eclipse 汉化 )插件安装包

    插件名称:m2eclipse、SVN、汉化插件 Eclipse版本:Eclipse3.7(eclipse-jee-indigo-SR2-win32.zip) 安装方式:link方式安装 操作系统:windows xp 安装步骤: 1、 将eclipse-jee-indigo-SR2-win32.zip解压到文件夹; ...

    eclipse 3.5.1 maven plugin

    Eclipse 3.5.1 Maven Plugin 是一个用于集成Maven构建系统到Eclipse IDE的插件,使得开发者能够在Eclipse环境中便捷地管理Maven项目、执行构建生命周期、解决依赖和配置问题。这个插件极大地提高了Java开发者的生产...

    eclipse-maven3-plugin工具

    Eclipse Maven3 Plugin是Eclipse集成开发环境中的一个插件,用于支持Maven项目管理和构建。这个插件使得开发者在Eclipse内部就能方便地管理Maven依赖、执行Maven生命周期阶段以及配置Maven项目,无需离开IDE。在描述...

Global site tag (gtag.js) - Google Analytics