ITeye博客

2012 年文章归档

共 17 篇文章

maven打包非java文件

在开发jsf应用处理国际化的时候,会将.properties文件放在src/main/java目录,然后在进行编译打包时,默认不会将非java的文件编译到class目录下。需要在<build>元素下添加一些内容: <build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.java</include > <include>**/*.properties</include > </includes> </resource> </resources> </build> 即…

2012-11-15 11:35 · java · maven

maven属性表示

属性 描述 ${basedir} 项目根目录 ${version} 项目版本 ${project.build.sourceDirectory} ${project.build.testsourceDirectory} ${project.build.directory} target ${project.outputDirectory} target/classes ${project.testOutputDirectory} target/test-classes ${project.groupId} ${project.artifactId} ${project.version} 与${…

2012-10-23 10:59 · maven

tomcat处理http请求

http://www.infoq.com/cn/articles/zh-tomcat-http-request-1

2012-10-10 15:09 · web · tomcat

java调试技巧

http://www.csdn.net/article/2012-09-03/2809495-Java-Debugging-Tips-with-Eclipse ClassWriter cw = new ClassWriter(...); * ClassVisitor sv = new SerialVersionUIDAdder(cw); * ClassVisitor ca = new MyClassAdapter(sv); * new ClassReader(orginalClass).accept(ca, false);

2012-10-10 09:46 · java · javaIDE

tomcat远程调试

修改${TOMCAT_HOME}/bin/catalin.bat。 set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=y 在命令行运行: catalina jdpa run 默认为8000

2012-06-25 23:42 · tomcat

jetty-maven-plugin使用说明

简介: jetty-maven-plugin用于maven项目的快速开发与测试。需要它时,像添加其它插件一样添加到maven项目中。 <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.4.v20120524</version> </plugin> 它可以周期性地查看web应用,当应用有修改时,会立即重部署。运行jetty的命令即: maven jetty:run 默认端口为:8080 配置jetty容器 配置web应用 插件为web应用提…

2012-06-22 11:04 · maven

spring表单标签

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> tomcat在解析jsp时,会在TldLocationCache类中,通过JarScanner对WEB-INF/lib下进行扫描,获取springmvc.jar中的META-INF/spring-form.tld,并加入到映射中。这样就可以解析spring标签了。

2012-06-20 23:23 · spring

maven的依赖范围

依赖范围是用来控制依赖与3种classpath(编译classpath,测试classpath,运行classpath)的关系。maven有以下几种依赖范围: Compile:编译依赖范围。默认使用此依赖范围,其下的maven依赖,对于编译,测试,运行classpath都有效。 Test:测试依赖范围。只对测试classpath有效,编译主代码或运行项目时无法使用此依赖。典型例子如junit。 Provided:已提供依赖范围。其对于编译与测试classpath有效,运行时无效。如在web开发时,只有在编译和测试时才用到servlet-api,将其设置为此范围,在运行时servlet-api…

2012-06-19 22:45 · maven

数组小例子

public class ArrayTest { private String[] cc = new String[0]; public void addCC(String ss){ String temp[] = new String[cc.length+1]; for(int i=0;i<cc.length;i++) temp[i] = cc[i]; temp[cc.length] = ss; cc = temp; } /** * @param args */ public static void main(String[] args) { ArrayTest sg = new Arra…

2012-06-19 22:21 · java

Enumeration,Hashtable和Vector

实现Enumeration接口的对象,它生成一系列元素,一次生成一个。连续调用nextElement方法将返回一系列连续的元素。 例如要输出Vector<E> V中的所有元素,可使用以下方法: 写道 for(Enumeration<E> e = v.elements(); e.hasMoreElements();){ System.out.println(e.nextElement); } 注:此接口的功能与 Iterator 接口的功能是重复的。此外,Iterator 接口添加了一个可选的移除操作,并使用较短的方法名。新的实现应该优先考虑使用 Iterator 接口而不是 Enumerat…

2012-06-18 23:43 · java

打印堆栈

复杂的程序不知道代码怎么走,就打印堆栈 StackTraceElement[] stack = Thread.currentThread().getStackTrace(); for (StackTraceElement ste : stack) { log.info(ste); }

2012-06-12 17:51 · java

maven随笔

1、原来jetty-maven-plugin是eclipse的。maven-jetty-plugin是codehaus的。 2、打包war时排除不需要的jar: <project> ... <dependencies> <dependency> <groupId>org.foo</groupId> <artifactId>bar-jar1</artifactId> <version>${pom.version}</version> <optional>true</optional> <!-- goes in manifest classpath, but not included in WE…

2012-06-07 16:55 · maven

使用maven-jetty-plugin测试

<build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.0.4.v20111024</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <webAppConfig> <contextPath>/test</contextPath> </webAppConfig> </configuration> </plugin> </p…

2012-05-30 09:19 · maven

跳过test

跳过测试: 命令行:mvn install -DskipTests pom: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skipTests>true</skipTests> </configuration> </plugin> 跳过测试代码编译: 命令行: mvn install -Dmaven.test.skip=true pom: <plugin> <groupId>org.apache.maven…

2012-05-23 14:03 · maven

不要在program files目录下安装jdk!

如果已经这么做了。出现问题时可以改为环境变量JAVA_HOME=C:/progra~1/java...

2012-05-17 17:55 · jdk

maven编译jdk1.4@deprecated异常

编译geronimo时。mvn clean install时总是出现以下异常: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project geronimo-kernel: Compilation failure: Compilation failure: D:\jee6\geronimo-jee6\deployer\modify\geronimo-kernel\src\main\java\org\apache\geronimo…

2012-05-17 15:53 · maven

servlet3.0的web.xml

2012-05-16 17:21 · web