Skip to main content

Posts

Showing posts from 2006

Run/Debug java webapp without packaging/deploying it with Jetty and under Maven2

Goals As the title mentioned, run(with maven2 command or in IDE)/debug(in IDE) java webapp without packaging the war file, installing/configuring any appserver like tomcat or deploying your code to anywhere. The practice will be "compile and run". Why Jetty ? Jetty is a lightweight, flexible and embeddable Java servlet container. It's so flexible that it can even start servicing a webapp directly from given classpath and a web.xml file without assembling them into a standard webapp. Step by step Introduce several dependencies into you pom file. This is required whatsoever if you want to run/debug jetty in IDE and make sure the servlet-api, xercesImpl and java tools.jar(if you want to run JSP) are in dependency list. <dependency> <groupId>jetty</groupId> <artifactId>org.mortbay.jetty</artifactId> <version>5.1.10</version> <scope>runtime</scope> </dependency> <dependency> <groupId>jetty</gr

Simplify Avalon components development by switching to plexus

Avalon vs. PicoContainer or Spring Looking for the best IoC container is not the purpose of this article. Well... there is no "the best" without conditions, which means the answer varies according to the project you are working on. Personally I found Avalon useful in several projects where the requirement and scope is extremely uncertain. PicoContainer project has an article which outlines the difference between several popular ways of containing components (not necessarily IoC containers). In general, comparing to the other options, Avalon depicts the lifecycle of a component elegantly and meticulously. And the compensation is to require the code to depend on its framework API. Headache of Avalon? Simplified version of Avalon container that costs you less, Plexus Assume you decide to take what Avalon requires and build the application on top Avalon API as I have done, the headache coming along is usally about: Maintain endless XML meta files for each componenent Bu

Is this my design?

I just came across this website design on deviantart.com. It resembles the home page of my waterview project amazingly. --http://www.deviantart.com/view/28556278-- --http://cyclops-group.sourceforge.net/projects/waterview--

Related content

The definition of a "project" * Have a specific objective to be completed within certain specification * Have a defined start and end date * Have finding limits (if applicable) * Consume human and none human resources (i.e., Money, people, equipments) * Are multifunctiotnal (i.e., cut across several function lines) Project management is the art of creating illusion that any outcome is a result of series predetermined, deliberate act when, in fact, it was dumb luck

Project management and planning class note #1

CS6388.501 Software Project Planning and Management. Instructor: John Cole Project Success: What is it? Project Failure? If you don’t have any failures, you aren’t taking enough risks. Control and commitment of resources: the Chiang Kai-Shek(蒋介石) model. The six stages of a project: * Wild enthusiasm * Disillusionment * Panic * Search for the guilty * Punishment of the innocent * Praise and rewards for the non-participants. “I want a list of all unforseen problems we’re going to encounter with this project.” Lines of communication in decision-making need to be as short as possible Project classification: * In-house R&D * Small construction * Large construction * Aerospace/defense * MIS (does this include software development?) * Engineering Problems of placing highly technical people in charge of projects. Moving a non-project-driven organization into project management. “Life is a game, and money is one way of keeping score.” So projects that pay off wel

继续和jetty/maven2浴血奋战

jetty6的最新版本似乎有很多问题。至少在我拿到的jetty-6.0-SNAPSHOT.jar中,任何post的表单都会把现成卡住。这是个很大的问题。jetty的支持对我说 这个问题 已经被处理,但我没有拿到任何新的版本的包。 不管怎么样,jetty这个古老的项目肯定是有稳定的可用版本的。查了一下5.1.10可能是最稳定的版本,所以我决定在已有的plugin里自己写一个启动jetty的Mojo来测试。 这个mojo不必像jetty自己的那个那么灵活可以设置端口,contextPath等,因为我的web应用里总是会有一个测试用的jetty.xml文件的。所以只要plugin允许用户告诉它这个文件在哪儿就行了。 这个程序非常简单,最终只是简单的调用了org.mortbay.jetty.Server.main, 带一个参数是jetty.xml的路径。它的源码可以在 这里 找到。

用jetty6和maven2启动,调试web应用

maven1的日子里对付web应用我一般的做法是用maven-appserver-plugin在项目的target目录里搭建只给当前项目开发用的 tomcat实例,通过配置maven-war-plugin, 可以把程序部署到这个tomcat实例里。调试时因为tomcat实例已经存在了,只要确定tomcat的bootstrap包在classpath里, 就可以在IDE里很容易的启动tomcat的实例。这个流程一旦配置好了很容易用,所以在过去的三年里我启动,调试web应用时都是这样做的。 maven2 里我一直在找类似的做法,可appserver插件没有了,war插件工作起来也不太一样,assembly最终必须产成一个文件,tomcat插件则是 通过tomcat的admin webapp把war热部署到运行的tomcat上,不容易调试。最终我决定试一试maven2的jetty插件。 jetty-maven-plugin是org.codehaus.mojo的子项目,还没有发布过什么稳定的版本,几个maven2 repository里也都没有,所以只能从svn上拿到源码手工安装。mojo项目源码在 这里 有 介绍。奇怪的是codehaus上各项目svn的位置这几天扑朔迷离, 公布的url经常无效。按照文档配置了maven-war-plugin和maven-jetty-plugin后(主要是设web.xml的位置),在 项目里执行 mvn clean compile war:war jetty:run-war, 报错说log4j找不到。log4j在pom.xml里有年头了,很多别的插件都在用它,这个错误没什么道理。 在maven2 repository里看到了jetty6的插件。这是一个和jetty插件,mojo项目无关的插件,是 jetty6 项 目里的一个子项目。与其把jetty插件里log4j的问题搞定,还不如试一试这个最新的东西。从codehaus svn上拿下jetty项目的源码,进入modules/maven-plugin, maven package install这个plugin。 在项目的pom.xml中做如下配置(这个修改最终可以放到这些web应用的父pom里去) <build> <plugins>

几个Maven2 repository proxy

dotsrc.org http://mirrors.dotsrc.org/maven2 central ggi-project.org http://ftp.ggi-project.org/pub/packages/maven2 central sunsite.dk http://mirrors.sunsite.dk/maven2 central planetmirror.com http://public.planetmirror.com/pub/maven2 central lsu.edu http://ibiblio.lsu.edu/main/pub/packages/maven2 central ibiblio.net http://www.ibiblio.net/pub/packages/maven2 central

Tapestry 4.0 is released

Tapestry一直是我很稀饭的一个Java Web Application Framework。 4.0的发布标志这它的成熟。 What is Tapestry's philosophy? Tapestry is organized around four key principles: Simplicity - web applications shouldn't be rocket science! Consistency - what works in pages should work in components. What works in small applications should work in large applications. Different developers should find similar solutions to similar problems. Efficiency - applications should be performant and scalable Feedback - when things go wrong, the framework should not get in the way; in fact, it should provide useful diagnostics These four principles drive the meta-principle: The simplest choice should be the correct choice. The decisions you make early in a project should not come back later to haunt you. We have found that a component approach to web development is the best way of realizing these principles. Structuring the framework and your application around components makes it possible

Maven2的牛刀小试

想把CyclopsGroup.com上所有的项目里的Maven升级到Maven2已经很久了,一直有很多顾虑。比如怎么和现有的AntHill集成, 过去已经发布的包包该怎么办。为了不影响大局,在新的arapaho这个独立,简单项目上,我决定完全抛弃Maven1。 安装maven2很简单,下载maven-2.0.1的包,解压在某处。把bin/mvn在/usr/local/bin下做一个symbolic link就行了。 第一件要做的事儿是吧CyclopsGroup.com网站搬过来。按照其他maven2里项目的模样,我创建了一个名 叫com.cyclopsgroup.arapaho的项目,并在下面创建arapaho-main-site子项目。这个arapaho-main- site是将来存放网站内容的地方。按照maven网站上 创建站点的文档 , 我只是简单的把xdoc目录考到src/site/目录下,创建site.xml文件,执行mvn site。静态页面很顺利的生成到了target/site下。 现在的问题是我需要把一段googleanalytics的javascript放到每页的头上。文档上没有指出该怎么做但是从 代码 上看,在site.xml文件里应该可以写<head>标记。 <project> <bannerLeft>... <body>... <head> <script src="http://www.google-analytics.com/urchin.js"... ... 很遗憾,mvn site后改动没有任何效果。这是因为当前的maven是2.0.1release,很多包都不是最新的。所以需要下载最近的maven。 svn co http://svn.apache.org/repos/asf/maven/components/trunk, 进入trunk执行./bootstrap.sh, 在maven-core/target下产生最新的maven-2.1-SNAPSHOT-bin。解压到另一个目录,在/usr/local/bin里 重建mvn连接。 再次mvn site还没效果,手工安装最新的插件试一试。 svn co http://svn.a