forked from bit-man/SwissArmyJavaGit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
192 lines (128 loc) · 6.68 KB
/
README.txt
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
JavaGit
TABLE OF CONTENTS
I. WELCOME
II. BUILDING JAVAGIT
III. USING JAVAGIT IN YOUR PROJECT
IV. DEVELOPING JAVAGIT WITH ECLIPSE
V. ADDING SOURCES FOR DEPENDENCIES
I. WELCOME
Swiss Army JavaGit (http://bit-man.github.io/SwissArmyJavaGit/) is a
Java API that provides access to git repositories.
Our goal is to provide a library with an easy-to-use API that is
intuitive for developers new to git and developers who are veteran
git users.
This is a fork from original JavaGit located at http://javagit.sourceforge.net/
Starting from 1.0 more robust and stable releases are being built mainly because
of some important decisions made regarding parsing and others.
This will affect in a good way the whole product but some minor incompatibilities
are expected related to v0.2
Still in ALPHA stage. Stay tuned and enjoy the ride !!
II. BUILDING JAVAGIT
JavaGit is built using Maven 2. The steps to get started with building
the source is:
1. Download Maven 2 from http://maven.apache.org and set it up.
2. Navigate on the command line to the project's JavaGit directory and
type:
$ mvn package
The jar file for the project will be deposited in the target
directory.
III. USING JAVAGIT IN YOUR PROJECT
JavaGit is currently only available in source form. To use JavaGit in
developing your application, you will need to check the source out of
the source repository and build the jar file. Once you have the jar file,
there are many ways to use it; three possible methods to use it are:
1. Build the JavaGit jar file, copy it into your project tree and integrate
the jar file into your build system and development environment.
2. Build the JavaGit jar file, install it in your local Maven 2 repository,
and refer to that jar file in your IDE and build scripts.
3. Import the JavaGit project into your development environemnt and use the
source directly.
Since JavaGit uses Maven 2 to build the project, here we describe how to
follow option 2.
a. Checkout the source code into a local sandbox.
b. Build JavaGit as described in section I.
c. While still in the javagit directory, type the command:
$ mvn install
The JavaGit jar file should now be installed in your local Maven 2
repository. On Unix systems this is:
~/.m2/repository/io/github/bit-man/javagit/
On Windows this is probably:
C:\Documents and Settings\<YourUser>\.m2\repository\javagit\javagit
d. If you are using Maven 2 as your project build tool, add JavaGit as a
dependency:
<dependency>
<groupId>io.github.bit-man</groupId>
<artifactId>javagit</artifactId>
<version>0.2.0</version>
</dependency>
If you are using ant, add the JavaGit jar file to your build path.
e. If you are using Eclipse as your IDE and you are using Maven 2 as your
build system, regenerate your Eclipse project files after adding the
JavaGit dependency using the following two commands in your project
sandbox:
$ mvn eclipse:clean
$ mvn eclipse:eclipse
If you are using Eclipse but are not using Maven 2 as your build
system, there are a few ways to use the installed JavaGit jar file
with your project.
1) Add the jar as a "Library" in your "Java Build Path":
- Open your project's "Propeties" dialog
- Click on "Java Build Path"
- Click on "Add JARs..."
- Find the installed JavaGit jar and select it for use
2) Add a variable to library variable for the M2 repository and then
add the jar file to the Libraries in your "Java Build Path":
- Open the workspace properties
- Go to "Java -> Build Path -> Classpath Variables"
- Click "New..."
- Type in the name "M2_REPO"
- Click "Folder..." and find the ~/.m2/repository directory
- Click "Choose", then click "OK" and "OK"
- Open your project's "Propeties" dialog
- Click on "Java Build Path"
- Click on "Add Variable..."
- Select the "M2_REPO" variable and click "Extend..."
- Find the JavavGit far file you want to use as the jar file
to develop against.
- Click "OK", then "OK", then "OK"
f. You are now ready to develop with JavaGit.
IV. DEVELOPING JAVAGIT WITH ECLIPSE
After you have completed part I,
1. Navigate to the root of the project you want to do development on
and type the command:
$ mvn eclipse:eclipse
The necessary .project and .classfile files will be generated for all
sub-projects of that project.
2. Open the JavaGit sandbox directory as your Eclipse workspace.
3. Open the workspace's Preferences and:
a. Navigate to "Java -> Build Path -> Classpath Variables"
b. Click on "New..."
c. Enter the Name as "M2_REPO" (without the quotes)
d. Click on "Folder..."
e. Choose the directory ~/.m2/repository
f. Press OK
g. Press OK
4. Choose the menu File -> Import... and:
a. Choose "General -> Existing Projects into Workspace"
b. Press "Next >"
c. Make sure the "Select root directory:" radio button is selected and
click "Browse..."
d. Choose the JavaGit directory and press "Choose"
e. Select the projects you want to import and press "Finish"
5. Start developing.
V. ADDING SOURCES FOR DEPENDENCIES
When developing in Eclipse, it is often desireable to see the sources for
the library dependencies of the project being worked on. To download the
sources for the dependencies, run the following command:
$ mvn dependency:sources
Once the sources are downloaded,
1. Go to Eclipse and "Ctrl-Left Click" (windows/linux) or "Cmd-Click"
(os x) a type from the dependency for which you want to view the
source.
2. Click "Attach Source"
3. Find the variable (M2_REPO) and the extension for the source zip/jar.
4. Press OK.
The source for the dependency should now be loaded.
Note: For JDK source, there is a src.zip file installed in the JAVA_HOME
directory of all Sun JDK installations. Attach this zip file for
browsing JDK source.