forked from Unidata/thredds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildDependencies.html
274 lines (267 loc) · 14.9 KB
/
BuildDependencies.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.2">
<title>NetCDF-Java Build Dependencies</title>
<link rel="stylesheet" href="./../cdm.css">
<link rel="stylesheet" href="./coderay-asciidoctor.css">
</head>
<body class="article">
<div id="header">
<h1>NetCDF-Java Build Dependencies</h1>
</div>
<div id="content">
<div class="sect1">
<h2 id="_building_with_maven_artifacts">Building with Maven artifacts</h2>
<div class="sectionbody">
<div class="paragraph">
<p>We make the NetCDF-Java library available as Maven artifacts. To use them in your build, you need to add the Unidata
Releases repository:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="xml"><span class="comment"><!-- In Maven --></span>
<span class="tag"><repositories></span>
<span class="tag"><repository></span>
<span class="tag"><id></span>unidata-releases<span class="tag"></id></span>
<span class="tag"><name></span>Unidata Releases<span class="tag"></name></span>
<span class="tag"><url></span>https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases/<span class="tag"></url></span>
<span class="tag"></repository></span>
<span class="tag"></repositories></span></code></pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span class="comment">// In Gradle</span>
repositories {
maven {
url <span class="string"><span class="delimiter">"</span><span class="content">https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases/</span><span class="delimiter">"</span></span>
}
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>Next, select modules based on the functionality you need. In the minimal case, you’ll just want <code>cdm</code> and a
<a href="#_logging">logger</a>. <code>cdm</code> implements the <a href="../CDM/index.html">CDM data model</a> and allows you to read NetCD-3 files (and a number of other
file types). An example using JDK14 logging:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="xml"><span class="comment"><!-- In Maven --></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>cdm<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>compile<span class="tag"></scope></span>
<span class="tag"></dependency></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>org.slf4j<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>slf4j-jdk14<span class="tag"></artifactId></span>
<span class="tag"><version></span>${slf4jVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span></code></pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span class="comment">// In Gradle</span>
dependencies {
compile <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:cdm:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
runtime <span class="string"><span class="delimiter">"</span><span class="content">org.slf4j:slf4j-jdk14:${slf4jVersion}</span><span class="delimiter">"</span></span>
}</code></pre>
</div>
</div>
<div class="paragraph">
<p>There are optional modules add support for reading (and sometimes writing) various
<a href="formats/FileTypes.html">scientific data formats</a>. The formats associated with each module are:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><code>bufr</code>: BUFR</p>
</li>
<li>
<p><code>clcommon</code>: GINI and FYSAT</p>
</li>
<li>
<p><code>grib</code>: GRIB-1 and GRIB-2</p>
</li>
<li>
<p><code>netcdf4</code>: NetCDF-4. Writing requires the <a href="netcdf4Clibrary.html">NetCDF-4 C library</a>
to be installed.</p>
</li>
<li>
<p><code>opendap</code>: OPeNDAP</p>
</li>
<li>
<p><code>visadCdm</code>: GEMPAK grid, station, and sounding; McIDAS grid; and ADDE image and station</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>You can include any number of the above components. To do so in Maven and Gradle:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="xml"><span class="comment"><!-- In Maven --></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>bufr<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>clcommon<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>grib<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>netcdf4<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>opendap<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span>
<span class="tag"><dependency></span>
<span class="tag"><groupId></span>edu.ucar<span class="tag"></groupId></span>
<span class="tag"><artifactId></span>visadCdm<span class="tag"></artifactId></span>
<span class="tag"><version></span>${netcdfJavaVersion}<span class="tag"></version></span>
<span class="tag"><scope></span>runtime<span class="tag"></scope></span>
<span class="tag"></dependency></span></code></pre>
</div>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span class="comment">// In Gradle</span>
dependencies {
runtime <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:bufr:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
runtime <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:clcommon:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
runtime <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:grib:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
runtime <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:netcdf4:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
runtime <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:opendap:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
runtime <span class="string"><span class="delimiter">"</span><span class="content">edu.ucar:visadCdm:${netcdfJavaVersion}</span><span class="delimiter">"</span></span>
}</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_building_with_netcdfall">Building with netcdfAll</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This is the appropriate option if you’re not using a dependency management tool like Maven or Gradle and you don’t
care about jar size or compatibility with other libraries. Simply include
<a href="https://artifacts.unidata.ucar.edu/content/repositories/unidata-releases/edu/ucar/netcdfAll/">netcdfAll-${netcdfJavaVersion}.jar</a>
on the classpath when you run your program. You’ll also need a <a href="#_logging">logger</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_logging">Logging</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The NetCDF-Java library uses the <a href="http://www.slf4j.org/">SLF4J</a> logging facade. This allows applications to choose their
own logging implementation, by including the appropriate jar file on the classpath at runtime. Common choices are:</p>
</div>
<div class="sect2">
<h3 id="__a_href_http_docs_oracle_com_javase_8_docs_api_java_util_logging_package_summary_html_package_description_jdk_logging_a"><a href="http://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html#package.description">JDK Logging</a></h3>
<div class="ulist">
<ul>
<li>
<p>You must include the SLF4J-to-JDK Logging interface jar: <code>slf4j-jdk14-${slf4jVersion}.jar</code>.</p>
</li>
<li>
<p>The actual logging is implemented in the <code>java.util.log</code> package, part of the Java runtime.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>To configure JDK logging:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Modify the file <code>$JAVA_HOME/jre/lib/logging.properties</code>. Or, create you own logging properties file and specify it
with the <code>java.util.logging.config.file</code> system property.</p>
</li>
<li>
<p>Possible log levels are <code>SEVERE</code>, <code>WARNING</code>, <code>INFO</code>, <code>CONFIG</code>, <code>FINE</code>, <code>FINER</code>, <code>FINEST</code>, and <code>ALL</code>.</p>
</li>
<li>
<p>To show only <code>SEVERE</code> messages for all loggers, use: <code>.level= SEVERE</code></p>
</li>
</ul>
</div>
<div class="paragraph">
<p>You can also set the configuration by using
<a href="http://docs.oracle.com/javase/8/docs/api/java/util/logging/LogManager.html">java.util.logging.LogManager</a> in your
application, most likely by creating your own properties file or resources and calling:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="java"><span class="predefined-type">FileInputStream</span> inputStream = <span class="keyword">new</span> <span class="predefined-type">FileInputStream</span>(<span class="string"><span class="delimiter">"</span><span class="content">my.properties</span><span class="delimiter">"</span></span>);
<span class="predefined-type">LogManager</span> lm = java.util.logging.LogManager.getLogManager();
lm.readConfiguration(inputStream);</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="__a_href_http_logging_apache_org_log4j_2_x_log4j_2_a"><a href="http://logging.apache.org/log4j/2.x/">Log4j 2</a></h3>
<div class="ulist">
<ul>
<li>
<p>You must include the <a href="https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html">Log4j 2 SLF4J Binding</a>
(<code>log4j-slf4j-impl-${log4j2Version}.jar</code>) and the Log4j 2 implementation (<code>log4j-core-${log4j2Version}.jar</code>) on the classpath.</p>
</li>
<li>
<p>You should then <a href="https://logging.apache.org/log4j/2.x/manual/configuration.html">configure</a> the logging by adding a
<code>log4j2.xml</code> config file to your classpath. A minimal version is:</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="CodeRay highlight"><code data-lang="xml"><span class="preprocessor"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="tag"><Configuration</span> <span class="attribute-name">status</span>=<span class="string"><span class="delimiter">"</span><span class="content">WARN</span><span class="delimiter">"</span></span><span class="tag">></span>
<span class="tag"><Appenders></span>
<span class="tag"><Console</span> <span class="attribute-name">name</span>=<span class="string"><span class="delimiter">"</span><span class="content">Console</span><span class="delimiter">"</span></span> <span class="attribute-name">target</span>=<span class="string"><span class="delimiter">"</span><span class="content">SYSTEM_OUT</span><span class="delimiter">"</span></span><span class="tag">></span>
<span class="tag"><PatternLayout</span> <span class="attribute-name">pattern</span>=<span class="string"><span class="delimiter">"</span><span class="content">%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</span><span class="delimiter">"</span></span><span class="tag">/></span>
<span class="tag"></Console></span>
<span class="tag"></Appenders></span>
<span class="tag"><Loggers></span>
<span class="tag"><Root</span> <span class="attribute-name">level</span>=<span class="string"><span class="delimiter">"</span><span class="content">error</span><span class="delimiter">"</span></span><span class="tag">></span>
<span class="tag"><AppenderRef</span> <span class="attribute-name">ref</span>=<span class="string"><span class="delimiter">"</span><span class="content">Console</span><span class="delimiter">"</span></span><span class="tag">/></span>
<span class="tag"></Root></span>
<span class="tag"></Loggers></span>
<span class="tag"></Configuration></span></code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_see_the_a_href_http_www_slf4j_org_manual_html_slf4j_manual_a_for_more_possibilites">See the <a href="http://www.slf4j.org/manual.html">SLF4J manual</a> for more possibilites.</h3>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2015-06-15 18:13:11 MDT
</div>
</div>
</body>
</html>