This may sound very easy, but it is not so if your directory structure
in CVS looks like the following and you want to mirror the same in your
IDE's package explorer.
webappname
...
webappname/WEB-INF/web.xml
webappname/WEB-INF/build.xml
...
webappname/WEB-INF/src - Java source files
webappname/WEB-INF/src/...
...
webappname/WEB-INF/classes - output directory for class files.
...
Without manually changing myEclipse project meta files, it is not quite
easy to get it right. Here are the steps that would help you save a lot
of time without manual modifications.
- Create a regular web project in myEclipse and give it a name, say "myproject".
- The important step is giving names for the folders in this window.
# "Source folder" - src, by default, do not change it.
# "Web root folder" - webappname, in other words, CVS module name
# "Context root URL" - webappname, in other words, CVS module name
- Finish creating the application
- When the application shows up on "Package Explorer" (left pane), right click
on webappname folder to delete it - This step is required to overwrite default
web.xml created by myEclipse under WEB-INF directory.
- Right click on the project name "myproject" to select "import" to configure
CVS repository location to check out your code.
- Now right click on "myproject" to open properties window.
- Select "Java build Path" on the left pane, and then select "Source" tab on the
right pane.
- Select the current source folder "src" to remove it.
- Click on "Add folder" button to traverse CVS module to choose
"webappname/WEB-INF/src" as the source directory.
- After choosing source folder, check the bottom of the current window to make
sure the output directory is "myproject/webappname/WEB-INF/classes.
Tuesday, June 5, 2007
Tuesday, May 1, 2007
Sighting design patterns(G4) in Java SE/EE
- This is a work in progress ...
- Structural Patterns
- Decorator - Servlet and Http Servlet request/response wrapper classes
- Proxy - Dynamic proxy - java.lang.reflect.Proxy
- Behavioral Patterns
- Chain of Responsibility - Servlet filters
- Iterator - Collection iterators
Thursday, April 26, 2007
Vim syntax highlighting for log files
If you are a "vim" user and looking for a quick way to do"syntax highlighting" for log files, created using "log4j", try this. The following was used in Vim 7.0.
Just make sure the log priority level("%p") is present in the log output.
# ~/.vim/filetype.vim should have at least the following.
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
" log files such as catalina.out or log4j files.
au! BufRead,BufNewFile catalina.out,*.out,*.out.*,*.log,*.log.* setf log
augroup END
# ~/.vim/syntax/log.vim - create this file
" Vim syntax file
" file type: log files
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syn match fatal ".* FATAL .*"
syn match fatal "^FATAL: .*"
syn match error ".* ERROR .*"
syn match error "^ERROR: .*"
syn match warn ".* WARN .*"
syn match warn "^WARN: .*"
syn match info ".* INFO .*"
syn match info "^INFO: .*"
syn match debug ".* DEBUG .*"
syn match debug "^DEBUG: .*"
syn match error "^java.*Exception.*"
syn match error "^java.*Error.*"
syn match error "^\tat .*"
" Highlight colors for log levels.
hi fatal ctermfg=Red ctermbg=Black
hi error ctermfg=Red ctermbg=Black
hi warn ctermfg=Yellow ctermbg=Black
hi info ctermfg=Green ctermbg=Black
hi debug ctermfg=Gray ctermbg=Black
let b:current_syntax = "log"
" vim: ts=2 sw=2
Just make sure the log priority level("%p") is present in the log output.
# ~/.vim/filetype.vim should have at least the following.
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
" log files such as catalina.out or log4j files.
au! BufRead,BufNewFile catalina.out,*.out,*.out.*,*.log,*.log.* setf log
augroup END
# ~/.vim/syntax/log.vim - create this file
" Vim syntax file
" file type: log files
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
finish
endif
syn match fatal ".* FATAL .*"
syn match fatal "^FATAL: .*"
syn match error ".* ERROR .*"
syn match error "^ERROR: .*"
syn match warn ".* WARN .*"
syn match warn "^WARN: .*"
syn match info ".* INFO .*"
syn match info "^INFO: .*"
syn match debug ".* DEBUG .*"
syn match debug "^DEBUG: .*"
syn match error "^java.*Exception.*"
syn match error "^java.*Error.*"
syn match error "^\tat .*"
" Highlight colors for log levels.
hi fatal ctermfg=Red ctermbg=Black
hi error ctermfg=Red ctermbg=Black
hi warn ctermfg=Yellow ctermbg=Black
hi info ctermfg=Green ctermbg=Black
hi debug ctermfg=Gray ctermbg=Black
let b:current_syntax = "log"
" vim: ts=2 sw=2
Subscribe to:
Posts (Atom)