`
wenson
  • 浏览: 1051227 次
  • 性别: 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

    然后,你可以使用IDE(如IntelliJ IDEA或Eclipse)导入这个项目,或者通过Maven的命令行工具运行`mvn jetty:run`来启动一个内置的Jetty服务器,以便于测试和调试应用。如果一切配置正确,你将能在浏览器中看到...

    AppFuse

    - 推荐工具:Eclipse 3.1、JDK 1.4.2、Tomcat 5.0.28、Ant 1.6.2、MySQL 4.1.7等。 - 对于不同的操作系统,推荐不同的开发工具组合。 2. **创建数据库与表**: - 在开始开发之前,首先需要根据项目需求创建...

    APPFUSE工具研究.doc

    AppFuse 2.0还更新了技术栈,支持JDK 5、注解、JSP 2.0和Servlet 2.4,同时提供了对Eclipse、IntelliJ IDEA和NetBeans等IDE的良好支持,以提高开发效率。 此外,AppFuse 2.0集成了多种开源项目,如: 1. **Struts ...

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

    **AppFuse 学习笔记(一):安装与部署** AppFuse 是一个开源项目,它提供了一种快速构建企业级 Web 应用程序的方式。它使用了多种流行的技术栈,如 Spring Boot、Hibernate、Thymeleaf 和 Maven,使得开发者可以更...

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

    AppFuse 是一个开源项目,它提供了快速开发Java Web应用程序的基础框架。这个框架集成了Spring、Hibernate和Struts等主流技术,使得开发者能够迅速构建出符合MVC架构的应用。在最新的版本2.1.0-M2中,AppFuse 提供了...

    appfuse 学习笔记

    ### Appfuse 学习笔记 #### 一、Appfuse 简介 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 ...

    AppFuse2.1所需包

    AppFuse 是一个开源项目,旨在简化Java Web应用程序的开发。它提供了一个基础架构,开发者可以在此基础上快速构建安全、可扩展的应用程序。AppFuse 2.1 版本是该项目的一个较早版本,但仍然包含了现代Web开发的核心...

    可直接使用的appfuse项目

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

    MAVEN 搭建APPFUSE

    【MAVEN 搭建APPFUSE】是一个关于使用Maven构建基于AppFuse的应用程序的教程。AppFuse是一个开源项目,旨在简化Web应用程序的开发,它提供了一个基础框架,可以帮助开发者快速启动新项目,整合了Spring、Hibernate、...

    使用appfuse构建环境

    - Eclipse是广泛使用的Java集成开发环境,用于AppFuse项目的开发和调试。 **7. 创建新项目** - 在命令行中进入AppFuse解压目录,并执行`ant new`命令。 - 根据提示输入项目名称(默认`myapp`)、数据库名称(默认`...

    Appfuse开发教程

    **Appfuse开发教程** Appfuse 是一个开源项目,它提供了一种快速开发Web应用程序的方式,尤其在使用Java技术栈时。本教程将深入探讨如何利用Appfuse创建数据访问对象(DAO)和简单Java对象(POJO),并进行数据库...

    AppFuse项目研究

    AppFuse 是一个由 Matt Raible 创建的开源项目,旨在为初学者提供一个快速入门的 J2EE 框架模板。它集成了多种流行的技术,包括 Spring、Hibernate、iBatis、Struts、Xdoclet 和 JUnit,同时也支持 Taperstry 和 JSF...

    Appfuse1.9至2.0.2

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

    Appfuse常用命令.doc

    文档中提到的是AppFuse中与Maven相关的常用命令,特别是针对Hibernate3的插件和maven-eclipse-plugin插件的使用。 1. Maven Hibernate3 Plugin: 这个插件主要用于自动化Hibernate的相关任务,如数据库映射文件的...

Global site tag (gtag.js) - Google Analytics