/
Ant.shtml
117 lines (98 loc) · 4.88 KB
/
Ant.shtml
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Mac OS X (vers 31 October 2006 - Apple Inc. build 15.17), see www.w3.org">
<title>JMRI: Building with Command Line Tools</title>
<meta name="author" content="Bob Jacobsen">
<meta name="keywords" content="JMRI technical code ant">
<!-- The combination of "Define" and {Header,Style, Logo and Footer} comments -->
<!-- are an arbitrary design pattern used by the update.pl script to -->
<!-- easily replace the common header/footer code for all the web pages -->
<!-- delete the following 2 Defines if you want to use the default JMRI logo -->
<!-- or change them to reflect your alternative logo -->
<!-- Style -->
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii">
<link rel="stylesheet" type="text/css" href="/css/default.css"
media="screen">
<link rel="stylesheet" type="text/css" href="/css/print.css"
media="print">
<link rel="icon" href="/images/jmri.ico" type="image/png">
<link rel="home" title="Home" href="/"><!-- /Style -->
</head>
<body>
<!--#include virtual="/Header" -->
<div id="mBody">
<!--#include virtual="Sidebar" -->
<div id="mainContent">
<h1>JMRI Code: Building with Command Line Tools</h1>
Those of you who prefer a command line approach might want to
investigate <cite><a href="#ant">ant</a></cite> and
<cite><a href="#maven">maven</a></cite>, build utilities for
Java projects. In the JMRI devlopment ecosystem, these two tools
complement each other, each providing unique capabilities the other
tool does not.
<h2 id="ant">Ant</h2>
Ant is available for download at
<a href="http://ant.apache.org/">http://ant.apache.org/</a>.
Install it, then:
<ul>
<li>Create a directory to contain your project.</li>
<li>In that project directory, <a href=
"http://jmri.org/help/en/html/doc/Technical/getgitcode.shtml">
get the code from GitHub</a>. This will create a
<tt>jmri</tt> subdirectory where Ant will run, and load it
with source, tests and resources. It will also create and
populate directories for xml, libraries, etc. in the
project directory.</li>
<li>Change to the newly created <tt>jmri</tt> subdirectory.
To compile, type <tt>ant debug</tt>.</li>
<li>To run the program, type <tt>ant decoderpro</tt> or
<tt>ant panelpro</tt>, and sit back to watch it go.</li>
<li>To run the test suite, type <tt>ant alltest</tt>.</li>
<li>To build a jmri.jar file, type <tt>ant dist</tt>. Note
that you don't have to create the <tt>jmri.jar</tt> file to
run the program.</li>
<li>To erase all previously compiled results and force the
program to be entirely built from scratch, type <tt>ant
clean</tt>.</li>
</ul>
<p>To make sure everything is working, before you e.g. commit
your code back, please do:</p>
<code>ant clean alltest</code>
<p>and make sure the tests run cleanly.</p>
<p>A new JMRI checkout should build cleanly. If not, please
check with the JMRIusers or jmri-developers mailings lists
for help.</p>
<h2 id="maven">Maven</h2>
Maven is an extensible plugin-based build tool for Java development.
Maven is available for download at
<a href="http://maven.apache.org/">http://maven.apache.org/</a>. Maven
will download the appropriate plugins and dependencies as needed.
After installation, the following can be done from your JMRI working copy
(see <a href="http://jmri.org/help/en/html/doc/Technical/getgitcode.shtml">Getting the Code</a>
for instructions on creating a working copy):
<dl>
<dt>Run unit and integration tests</dt>
<dd><code>mvn test</code><br>Use <code>mvn test -Dtest=PATTERN</code> to
run specific tests. See
<a href="https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html">Running a Single Test</a>
for more details, including running only a single test method.</dd>
<dt>Check for vulnerabilities in JMRI dependencies</dt>
<dd><code>mvn compile net.ossindex:ossindex-maven-plugin:audit</code></dd>
<dt>Check for newer versions of JMRI dependencies</dt>
<dd><code>mvn versions:display-dependency-updates</code></dd>
<dt>Check for newer versions of the maven plugins</dt>
<dd><code>mvn versions:display-plugin-updates</code></dd>
<dt>Run DecoderPro</dt>
<dd><code>mvn antrun:run -Danttarget=decoderpro</code></dd>
<dt>Run PanelPro</dt>
<dd><code>mvn antrun:run -Danttarget=panelpro</code></dd>
</dl>
<!--#include virtual="/Footer" -->
</div><!-- closes #mainContent-->
</div><!-- closes #mBody-->
</body>
</html>