`
wenson
  • 浏览: 1043747 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Appfuse developed by Eclipse

阅读更多

Eclipse is by far and away the most popular IDE among Java developers.

Table of Contents

  1. Download and Install
  2. Integration with WTP
  3. Debugging
  4. Spring Support
  5. Tips and Tricks

Download and Install

 

To make your project Eclipse-aware, perform the following steps:

 

  1. Read Development Environment for additional configuration information.
  2. Download Eclipse 3.2 or Eclipse 3.3Rc2 and use Callisto (Software Update) to get plugins for developing web and database-driven applications.
  3. Install Eclipse into $TOOLS_HOME/eclipse-3.2.
  4. When starting Eclipse, set your workspace directory to C:\Source on Windows and ~/dev on *nix.
  5. In your project's directory, run mvn eclipse:eclipse. This will generate project files using the Maven Eclipse Plugin. If you're using a modular archetype, you may need to run mvn install eclipse:eclipse.
  6. Launch Eclipse and go to File > Import > Existing Projects into Workspace (under the General category). Select the root directory of your project, followed by the modules to import. Click Finish to complete the process.

Set the classpath variable M2_REPO. Eclipse needs to know the path to the local maven repository. You should be able to do this by executing the command: mvn -Declipse.workspace=C:\Source eclipse:add-maven-repo.

If that doesn't work, can also define a new classpath variable inside Eclipse. From the menu bar, select Window > Preferences. Select the Java > Build Path > Classpath Variables page and set M2_REPO to equal ~/.m2/repository.

After configuring Eclipse, you should be able to compile your project and run tests from within your IDE. For tests that rely on pre-existing data, you may have to periodically run mvn dbunit:operation to re-populate your database. You shouldn't need to worry about deploying from Eclipse because you can use the Jetty Plugin (mvn jetty:run-war) or Cargo (mvn cargo:start -Dcargo.wait=true). If you'd prefer to use the Eclipse Web Tools Project to auto-deploy your project, see the Integration with WTP section below.

For more information on using Eclipse with Maven, see Maven's Eclipse Mini-Guide.

If you'd like to run Maven from Eclipse, see the Maven 2.x Eclipse Plugin.

The Eclipse project is likely to show multiple errors which are in fact not really errors. See APF-649

Integration with Eclipse Web Tools Project (WTP)

See: Eclipse Web Tools Project

Below are some quick instructions contributed by Shash Chaterjee.

  1. Use the AppFuse archetypes to create the project. I used the Struts-2 Modular version. If you're not using a modular archetype, you can skip to step #6.
  2. Under "myproject", create a new dir called pom. Copy myproject/pom.xml to myproject/pom/pom.xml.
  3. Modify myproject/pom.xml to change the artifactId to "myproject-pom".
  4. Modify core/pom.xml and web/pom.xml to change the parent pom artifactId to
    "myproject-pom" and delete the relativePath element
  5. Modify myproject/pom.xml to add the "pom" module, in addition to core and web in the modules section
  6. Run mvn install eclipse:eclipse
  7. Edit myproject/web/.settings/org.eclipse.wst.common.component:
    • Delete <wb-resource deploy-path="/" source-path="src/main/webapp"/>
    • Add <wb-resource deploy-path="/" source-path="target/myproject-webapp-1.0-SNAPSHOT"/>
    • Delete <wb-resource deploy-path="/WEB-INF/classes" source-path="src/main/resources"/>
    • Edit myproject/web/.classpath
    • Delete <classpathentry kind="src" path="src/main/resources" excluding="ApplicationResources_zh*.properties ... **/*.java"/>
    • Add <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5"/>
    • Add <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
  8. Preferences -> Java -> Installed JREs: Make sure default JRE is actually the JDK and not the JRE.
  9. Preferences -> Server -> Installed Runtimes: Pick an Apache -> Tomcat 5.5 server, and point it to your local installation.
  10. Import -> Existing Projects into Workspace: Point to your AppFuse project dir and import myproject-core and myproject-web.
  11. Open J2EE perspective, then Run->Run On Server (when prompted, connect it to the Tomcat server you configured previously)
  12. You may want to copy the launch configuration and then add all the properties defined in myproject/pom.xml.

Debugging

One of the nice things about AppFuse 2.0 is you shouldn't have to use Maven for the most part. It has much better IDE support now. You should be able to run most of your tests from within Eclipse. If you can run your tests, you should be able to debug them as well. If you write your tests so they don't depend on data already being in the database, you should be able to run your tests all day long. If you depend on pre-existing data, you may have to run mvn dbunit:operation (same as ant db-load in AppFuse 1.x) every so often, or use DbUnit's Java API to pre-populate your database.

To debug your application while running it in Jetty , see Debugging with the Maven Jetty Plugin in Eclipse.

Spring Support

Spring IDE is an excellent plugin to install for viewing, graphing and navigating Spring beans. Installing it should be fairly straight forward. Below is an example graph created with Spring IDE.

Tips and Tricks

  • Ctrl+Shift+R will allow you to find any file within your project. It's a handy way to open files quickly without having to navigate through your source tree.
    • Ctrl+Shift+T does the same, but restricted to Java source files (Java view only).
  • Ctrl+Shift+E opens a dialog with the files you most recently open listed.

In order to clean up the project view in Eclipse, you can hide the files you don't need. First of all, make sure you're in the Java Perspective (Window → Open Perspective). Then click the little (down) arrow in the top right corner of the Package Explorer pane. Select Filters and check Libraries from external and Libraries from project. Click OK to continue.

Another useful Eclipse trick is to use abbreviated package names. It's a nice feature on projects where you're inflicted with super.long.package.name.syndrome. Go to Window -> Preferences -> Java -> Appearance. Check the "Compress all package names" checkbox and type "1." (no quotes) in the text field.

评论

相关推荐

    ibatis版appfuse eclipse工程

    已经调试好的ibatis版appfuse eclipse工程。帮助学习appfuse。表结构 和hibernate的相同。

    appfuse

    使用appfuse2.0,下载过来的实例源码,没有jar包

    AppFuse入门文档(AppFuse与SpringMVC+mybatis整合)

    本文档详细描述了AppFuse与SpringMVC+mybatis整合的过程,只要你懂一些基本的eclipse操作和基本的maven命令,就可以在三分钟之内迅速的搭建出一个AppFuse的架构

    AppFuse

    本文以一个 J2EE 开发者的角度,借助一个简单的应用示例,在融合了个人经验的基础上介绍了如何用 AppFuse 一步步地构建 J2EE 项目。通过阅读本文,读者不仅能够学会用 AppFuse 进行开发,而且能够充分体会到 AppFuse...

    APPFUSE工具研究.doc

    Appfuse是一个开源的工程应用,它集成了现在最流行的开发框架到该应用中,使用Maven可以很方便的开发和部署...也可以集成到现在流行的开源开发工具如eclipse,idea等。现在让我们简单的看看APPFUSE开发应用的简单性。

    appfuse1.4-architecture

    06年时的appfuse,学习SSH架构的经典入门框架。相对比较老的资料,可以欣赏一下当时的架构,向牛人致敬

    appfuse.tar.gz

    3. Rename the appfuse/data/.project back and refresh your left pane in Eclipse. 4. Repeat these steps for the "web" directory. IDEA 6.0+: ---------- From the command line, cd into the appfuse ...

    可直接使用的appfuse项目

    AppFuse是一个集成了众多当前最流行开源框架与工具(包括Hibernate、ibatis、Struts、Spring、DBUnit、Maven、Log4J、Struts Menu、Xdoclet、SiteMesh、OSCache、JUnit、JSTL等(现在还有lucene的,无敌了))于一身的...

    Appfuse1.9至2.0.2

    主要是自己从网络上搜集的一些关于appfuse1.8.2-2.0.2的一些相关资料,间或有点自己试验的记录,还有点maven和quartz的东东,之前我主要是用1.8.2构建项目,感觉还不错,希望对想学习appfuse的人有些帮助.

    appfuse新手上路

    新手使用appfuse2.0,启动步骤和配置过程

    AppFuse2.1所需包

    AppFuse2.1所需包,主要包括Spring MVC+Hibernate4 还有一些其它包!

    appfuse 学习笔记

    Appfuse 一个开放源码的项目和应用程序,帮助我们快速而高效的地开发。

    AppFuse项目研究

    Appfuse是由Matt Raible开发的一个指导性的入门级J2EE框架,它对如何集成流行的Spring、Hibernate、iBatis、struts、Xdoclet、junit 等基础框架给出了示范。提供了对Taperstry和JSF的支持

    Appfuse框架解析

    Appfuse框架解析,包括登陆验证,执行顺序,加载策略等。

    appfuse学习笔记(一)安装部署

    NULL 博文链接:https://savagegarden.iteye.com/blog/427169

    建立项目原型骨架的步骤(最新版本appfuse)appfuse2.1.0-M2

    建立项目原型骨架的步骤(最新版本appfuse)appfuse2.1.0-M2 spring3.0 hibernte3.3 struts2.1.8

    基于AppFuse框架的B2C电子商务系统研究与实现

    基于AppFuse框架的B2C电子商务系统研究与实现

    SSH学习及开发框架-appfuse

    appfuse 有struts2+hibernate+spring的整合 springmvc+hibernate+spring的整合 多模块,但模块都有 学习开发参考使用非常方便 可以到官方下载最新版的,我只是把自己下载的打包整理一下 注意哈,都是基于maven的...

    appfuse使用手册

    代码自动生成工具appfuse的中文使用手册

Global site tag (gtag.js) - Google Analytics