-
Notifications
You must be signed in to change notification settings - Fork 3
/
HACKING
68 lines (42 loc) · 2.1 KB
/
HACKING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
== Coding Style ==
We follow standard Java coding style:
http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
Four spaces are used for indentation and tabs are never used.
In Eclipse, you should go to:
Windows->Preferences->Java->Code Style->Formatter
then select the 'Java conventions' profile, click Edit, change the
profile name to 'Java conventions [no tabs]' and then in:
Indentation, General settings->Tab policy
select 'Spaces Only' and hit OK.
== On Whitespace ==
Graphic designers know that the judicious use of whitespace is
critical in good design. That goes for code legibility too. If adding
a blank line makes your code more legible, then go for it!
On the other hand, trailing whitespace is the spawn of satan. Okay,
maybe not, but it adds no value and can cause unnecessary churn and
conflicts. So, let's try and avoid it.
Set up a git pre-commit hook in your local repository to check for it:
$> mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
This will not allow you to create a commit containing trailing
whitespace. You can also manually check your current changes using:
$> git diff --check
In Eclipse, you go to 'Windows->Preferences->General->Keys' and bind
'Remove Trailing Whitespace' to e.g. Alt-w. That way you can just do
Alt-w before saving a file.
== Git ==
Before committing any changes, add the following to your ~/.gitconfig:
[user]
name = Joe X. User
email = [email protected]
Try and isolate logical changes into individual commits. You can
modify your latest commit using 'git commit --amend' and modify your
commit queue using 'git rebase -i origin/master'.
== Debugging Jetty using Eclipse ==
It is possible to attach Eclipse to Jetty by using mvnDebug:
$> mvnDebug jetty:run
This will launch a debug server on port 8000. In Eclipse, you go to 'Run->Debug
Configurations' and create a 'Remote Java Application'. Select your project and
run it. Jetty will start as soon as Eclipse connects. Now you can add
breakpoints and debug as you would normally do.
See http://docs.codehaus.org/display/MAVENUSER/Dealing+with+Eclipse-based+IDE
for more details.