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 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="SHORTCUT ICON" href="https://issues.apache.org/jira/secure/attachment/12322581/12322581_final_logo64.png">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<title>Building Derby</title>
</head>
<body>
<TABLE>
<TBODY>
<TR>
<TD><img src="https://issues.apache.org/jira/secure/attachment/12322583/12322583_final_logo.png" alt="Derby Hat"/></TD>
<TD><h1>Building Derby</h1></TD>
</TR>
</TBODY>
</TABLE>
<ul>
<li><a href="#About This Document">About This Document</a></li>
<li><a href="#Downloads">Downloads</a></li>
<li><a href="#Simple Build">Simple Build</a>
<ul>
<li><a href="#Verifying the Build">Verifying the Build</a></li>
<li><a href="#Testing Derby">Testing Derby</a></li>
</ul>
</li>
<li><a href="#Customized Build">Customized Build</a>
<ul>
<li><a href="#Advanced Build">Advanced Build</a></li>
</ul>
</li>
</ul>
<br/><br/><br/><hr color="blue"/>
<h2><a name="About This Document">About This Document</a></h2>
<p>
These are the instructions for building the Derby jar files
from the Derby sources.
</p>
<br/><br/><br/><hr color="blue"/>
<h2><a name="Downloads">Downloads</a></h2>
<p>
Before building Derby, you need to download the following:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Prerequisite</b></TD>
<TD><b>Description</b></TD>
</TR>
<TR>
<TD><b><i>Derby Source</i></b></TD>
<TD>
If you are reading these instructions, chances
are you have already unpacked a Derby source distribution. However,
if you don't have the Derby source yet, get the development source tree from subversion by following these
<a href="http://db.apache.org/derby/dev/derby_source.html">instructions</a>.
</TD>
</TR>
<TR>
<TD><b><i>Java Development Kit</i></b></TD>
<TD>You need to install a Java 5 or later JDK. Probably, your machine
already has this JDK. If not, Sun and IBM supply free JDKs for many machines.</TD>
</TR>
<TR>
<TD><b><i>Ant</i></b></TD>
<TD>You need to install the Ant build tool, version 1.7.0 or
higher. You can get Ant <a href="http://ant.apache.org/">here</a>.</TD>
</TR>
</TBODY>
</TABLE>
<br/>
<a name="Downloading JUnit"/>
<p>
If you are going to run the Derby tests, then you will need to download the JUnit
test harness also:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Prerequisite</b></TD>
<TD><b>Description</b></TD>
</TR>
<TR>
<TD><b><i>JUnit</i></b></TD>
<TD>You need the JUnit test tool, version 3.8.2.
The Ant build script will try to download JUnit for you
automatically if it's missing. If this fails for some reason,
you can download and install JUnit manually.
You can get JUnit 3.8.2 <a href="http://www.junit.org/">here</a>.
Copy <i>junit.jar</i> into your Derby source tree, in the
<i>tools/java</i> directory.
</TD>
</TR>
</TBODY>
</TABLE>
<br/>
<br/><br/><br/><hr color="blue"/>
<h2><a name="Simple Build">Simple Build</a></h2>
<p>
Before building Derby, cd
to the root of your Derby source distribution. That is the top level
directory which contains the LICENSE and NOTICE files. In addition,
make sure that the version of Java which you are using is Java 5 or
later. You can verify this by checking the output of the following command:
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
java -version
</font></b></pre>
</blockquote>
<p>
Now use the following Ant targets to build Derby.:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Target</b></TD>
<TD><b>Description</b></TD>
<TD><b>Command</b></TD>
</TR>
<TR>
<TD><b><i>clobber</i></b></TD>
<TD>This target deletes all build artifacts.</TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet clobber
</font></b></pre>
</blockquote>
</TD>
</TR>
<TR>
<TD><b><i>buildsource</i></b></TD>
<TD>This target compiles all source files needed for the Derby
product. Don't be alarmed by all of the compiler warnings. We'll
show you how to tidy those up <a href="#Customized Build">later on</a>.
</TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet buildsource
</font></b></pre>
</blockquote>
</TD>
</TR>
<TR>
<TD><b><i>buildjars</i></b></TD>
<TD>This target builds the Derby jar files.</TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet buildjars
</font></b></pre>
</blockquote>
</TD>
</TR>
</TBODY>
</TABLE>
<br/>
<p>
So, do this:
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet clobber
ant -quiet buildsource
ant -quiet buildjars
</font></b></pre>
</blockquote>
<p>
In order to build the Derby javadoc, you will need to run another target:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Target</b></TD>
<TD><b>Description</b></TD>
<TD><b>Command</b></TD>
</TR>
<TR>
<TD><b><i>javadoc</i></b></TD>
<TD>This target builds the Derby javadoc. Be patient. The
<i>javadoc</i> target takes a while.</TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet javadoc
</font></b></pre>
</blockquote>
</TD>
</TR>
</TBODY>
</TABLE>
<blockquote>
<br/>
<br/>
<h3><a name="Verifying the Build">Verifying the Build</a></h3>
<p>
Run the <i>sysinfo</i> command to verify that the jars built
correctly. This program will print out the Derby build information:
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
java -jar jars/sane/derbyrun.jar sysinfo
</font></b></pre>
</blockquote>
<br/>
<h3><a name="Testing Derby">Testing Derby</a></h3>
<p>
If you want to build and run the Derby tests, make sure that you have downloaded
the
<a href="#Downloading JUnit">JUnit</a>
test framework. Then build all of the Derby sources, including the test classes:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Target</b></TD>
<TD><b>Description</b></TD>
<TD><b>Command</b></TD>
</TR>
<TR>
<TD><b><i>all</i></b></TD>
<TD>This target compiles all Derby source files.</TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet all
</font></b></pre>
</blockquote>
</TD>
</TR>
</TBODY>
</TABLE>
<p>
Putting all of this together, here's how you build the tests:
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -quiet clobber
ant -quiet all
ant -quiet buildjars
</font></b></pre>
</blockquote>
<p>
To run the tests, consult the testing
<a href="./java/testing/README.htm">README</a>.
</p>
</blockquote>
<br/><br/><br/><hr color="blue"/>
<h2><a name="Customized Build">Customized Build</a></h2>
<p>
You can customize the Derby build by setting variables in a file
called <i>ant.properties</i>. The Ant tool looks for this file in your
home directory.
To find out where Ant thinks your home directory is,
issue the following command and look for "user.home" in the output:
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
ant -diagnostics
</font></b></pre>
</blockquote>
<br/>
<p>
Alternatively, or additionally, you can place properties in a file called 'local.properties' in the top of the source tree. Properties placed in this file have precedence over those in user.home/ant.properties.
</p>
<p>
Here are some Derby-specific variables which you may want to set in <i>ant.properties</i>:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Variable</b></TD>
<TD><b>Description</b></TD>
<TD><b>Default</b></TD>
<TD><b>Example</b></TD>
</TR>
<TR>
<TD><b><i>deprecation</i></b></TD>
<TD>Turn this flag off if you don't want to see pages of
warnings generated when the compiler encounters references to
deprecated methods.</TD>
<TD><blockquote><i>on</i></blockquote></TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
deprecation=off
</font></b></pre>
</blockquote>
</TD>
</TR>
<TR>
<TD><b><i>sane</i></b></TD>
<TD>By default, this variable is set to <i>true</i>. This builds
extra assertion and debugging logic into Derby classes. If you
set this variable to false, then the Derby jar files will be
smaller and Derby will run faster. During typical development,
you will leave this variable set to <i>true</i>. However, this
variable is set to <i>false</i> when building official Derby releases.</TD>
<TD><blockquote><i>true</i></blockquote></TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
sane=false
</font></b></pre>
</blockquote>
</TD>
</TR>
<TR>
<TD><b><i>junit</i></b></TD>
<TD>Setting this property will overwrite the default location for
<i>junit.jar</i>, used to build the tests.
The default location is <i>tools/java</i>.
If you set this property, the build will not automatically download
<i>junit.jar</i>, and if it's not in the specified location, the build will
stop.</TD>
<TD><blockquote><i>tools/java/junit.jar</i></blockquote></TD>
<TD>
<blockquote>
<pre><b><font color="blue" size="+2">
junit=/local0/junit.jar
</font></b></pre>
</blockquote>
</TD>
</TR>
</TBODY>
</TABLE>
<br/>
<br/>
<blockquote>
<h3><a name="Advanced Build">Advanced Build</a></h3>
<p>
Derby is supposed to run in all of the following environments:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Platform</b></TD>
<TD><b>JDBC Level</b></TD>
</TR>
<TR>
<TD><b><i>Java 7</i></b></TD>
<TD><b><i>JDBC 4.1</i></b></TD>
</TR>
<TR>
<TD><b><i>Java 6</i></b></TD>
<TD><b><i>JDBC 4.0</i></b></TD>
</TR>
<TR>
<TD><b><i>Java 5</i></b></TD>
<TD><b><i>JDBC 3</i></b></TD>
</TR>
<TR>
<TD><b><i>Small Device (CDC/FP 1.1)</i></b></TD>
<TD><b><i>JSR169</i></b></TD>
</TR>
</TBODY>
</TABLE>
<br/>
<p>
The default Derby build does NOT necessarily verify that the compile-time contract is
satisfied for any of these platforms. To get compile-time checks, you
need to make sure that the following variables are set correctly. To
see the values which the Derby build uses for these variables, build
Derby after setting the
following debug variable in your <i>ant.properties</i>:
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
printCompilerProperties=true
</font></b></pre>
</blockquote>
<br/>
<p>
Here are the variables which determine whether the Derby build
enforces compile-time contracts for the supported platforms:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Platform</b></TD>
<TD><b>Compiler Variable</b></TD>
<TD><b>Description</b></TD>
<TD><b>Default Value</b></TD>
</TR>
<TR>
<TD><b><i>Java 7</i></b></TD>
<TD><b><i>java17compile.classpath</i></b></TD>
<TD>The set of libraries in the Java 7 JDK. The build fails if
your environment isn't a Java 5, 6 or 7 JDK.</TD>
<TD>The set of system jars in your JDK if your environment is
JDK 7. Otherwise,
<i>${java16compile.classpath}</i></TD>
</TR>
<TR>
<TD><b><i>Java 6</i></b></TD>
<TD><b><i>java16compile.classpath</i></b></TD>
<TD>The set of libraries in the Java 6 JDK. The build fails if
your environment isn't a Java 5, 6 or 7 JDK.</TD>
<TD>The set of system jars in your JDK if your environment is
JDK 6. Otherwise, <i>classes/stubs/jdbc4:${java15compile.classpath}</i> if your environment
is JDK 5. Otherwise
<i>${java17compile.classpath}</i></TD>
</TR>
<TR>
<TD><b><i>Java 5</i></b></TD>
<TD><b><i>java15compile.classpath</i></b></TD>
<TD>The set of libraries in the Java 5 JDK. The build fails if
your environment isn't a Java 5, 6 or 7 JDK.</TD>
<TD>The set of system jars in your JDK if your environment is
JDK 5. Otherwise,
<i>classes/stubs/jdbc3:${java16compile.classpath}</i></TD>
</TR>
<TR>
<TD><b><i>Small Device (CDC/FP 1.1)</i></b></TD>
<TD><b><i>jsr169compile.classpath</i></b></TD>
<TD>This should be set to the list of small device libraries on
your machine--if you have them. That is, the CDC/FP 1.1 jars and
the jsr169 jar. To get a set of small device libraries, see
<a href="http://blogs.sun.com/wittyman/entry/javadb_on_sun_javame_cdc">Oracle's instructions</a>
or download IBM's WCTME 5.7.
</TD>
<TD><i>classes/stubs/jsr169:${java15compile.classpath}</i></TD>
</TR>
</TBODY>
</TABLE>
<br/>
<p>
The preceding variables are mandatory for the Derby build.
You can also force the setting of the preceding variables by setting the following optional
library variables in <i>ant.properties</i>:
</p>
<TABLE border="2">
<TBODY>
<TR>
<TD><b>Compiler Variable</b></TD>
<TD><b>Description</b></TD>
<TD><b>Default Value</b></TD>
</TR>
<TR>
<TD><b><i>j15lib</i></b></TD>
<TD>If you set this variable to be the directory which contains
your Java 5 jars, then the Derby build will set
<i>java15compile.classpath</i> to be the list of jars in that directory.
</TD>
<TD>Optional variable. No default value.</TD>
</TR>
<TR>
<TD><b><i>j16lib</i></b></TD>
<TD>If you set this variable to be the directory which contains
your Java 6 jars, then the Derby build will set
<i>java16compile.classpath</i> to be the list of jars in that directory.
</TD>
<TD>Optional variable. No default value.</TD>
</TR>
<TR>
<TD><b><i>j17lib</i></b></TD>
<TD>If you set this variable to be the directory which contains
your Java 7 jars, then the Derby build will set
<i>java17compile.classpath</i> to be the list of jars in that directory.
</TD>
<TD>Optional variable. No default value.</TD>
</TR>
</TBODY>
</TABLE>
<br/>
<p>
Here, for instance, are some sample settings of classpath
variables (you should omit the \ continuation markers, which are
included in these examples
simply to improve readability):
</p>
<blockquote>
<pre><b><font color="blue" size="+2">
java16compile.classpath=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/charsets.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/classes.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/dt.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/jce.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/jconsole.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/jsse.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/laf.jar: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/management-agent: \
/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Classes/ui.jar
jsr169compile.classpath=/Users/myself/sw/phoneME/phoneme_advanced_mr2/lib/btclasses.zip: \
/Users/myself/sw/phoneME/phoneme_advanced_mr2/lib/basis.jar: \
/Users/myself/sw/jsr169Support/jdbc.jar
</font></b></pre>
</blockquote>
</blockquote>
<br/><br/><br/><hr color="blue"/>
</body>
</html>
|