Skip to content

Commit e84e65e

Browse files
committed
Usage: improve the part about Maven/Gradle
1 parent faed16d commit e84e65e

File tree

1 file changed

+45
-13
lines changed

1 file changed

+45
-13
lines changed

usage.html

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -149,29 +149,35 @@ <h3 class="subtema" id="gradle">Usage from a Gradle project</h3>
149149
</p>
150150
<h3 class="subtema" id="maven">Usage from a Maven build</h3>
151151
<p>
152-
If you build your project (that depends on css4j) with Apache Maven, please note that some of the css4j dependencies are not in
153-
Maven Central:
152+
If you build your project (that depends on css4j) with Apache Maven, please note that neither css4j nor some of its
153+
dependencies are in Maven Central:
154154
</p>
155155
<ul>
156156
<li><a href="https://sourceforge.net/projects/jclf/">JCLF</a>.</li>
157157
<li><a href="https://github.com/xmlpull-xpp3/xmlpull-xpp3">XMLPull-XPP3</a> (v1.2, dependency of the DOM4J module only).</li>
158158
</ul>
159159
<p>
160-
You may want to install them manually into your local Maven repository, which can be done easily with the:
160+
So you may want to add css4j's Maven repository to your POM file:
161+
</p>
162+
<pre class="code"><code class="language-xml">&lt;repositories&gt;
163+
&lt;repository&gt;
164+
&lt;id&gt;css4j&lt;/id&gt;
165+
&lt;name&gt;CSS4J repository&lt;/name&gt;
166+
&lt;url&gt;https://css4j.github.io/maven/&lt;/url&gt;
167+
&lt;/repository&gt;
168+
&lt;/repositories&gt;
169+
</code></pre>
170+
<p>
171+
Alternatively, you can also install the artifacts manually into your local Maven repository,
172+
which can be done easily with the:
161173
</p>
162174
<ul>
175+
<li><a href="https://raw.githubusercontent.com/css4j/css4j-dist/master/maven/install-css4j.sh"><code>install-css4j.sh</code></a></li>
163176
<li><a href="https://raw.githubusercontent.com/css4j/css4j-dist/master/maven/install-jclf.sh"><code>install-jclf.sh</code></a></li>
164177
<li><a href="https://raw.githubusercontent.com/css4j/css4j-dist/master/maven/install-xpp3.sh"><code>install-xpp3.sh</code></a></li>
165178
</ul>
166179
<p>
167-
scripts.
168-
</p>
169-
<p>
170-
You can also directly install the CSS4J artifacts into your local Maven repository, with the similar
171-
<a href="https://raw.githubusercontent.com/css4j/css4j-dist/master/maven/install-css4j.sh"><code>install-css4j.sh</code></a>.
172-
</p>
173-
<p>
174-
And then, add the following to the <code>&lt;dependencies&gt;</code> section of your <code>pom.xml</code>:
180+
scripts. And then, add the following to the <code>&lt;dependencies&gt;</code> section of your <code>pom.xml</code>:
175181
</p>
176182
<pre class="code"><code class="language-xml">&lt;!-- This artifact is not in Maven Central --&gt;
177183
&lt;dependency&gt;
@@ -282,18 +288,44 @@ <h2>Examples with DOM4J</h2>
282288
api "io.sf.carte:css4j-dom4j:${css4jDom4jVersion}"
283289
}
284290
</code></pre>
285-
<p>or with Apache Maven:</p>
291+
<p>But please remember that you have to set up css4j's repository, if you haven't already:</p>
292+
<pre class="code"><code class="language-groovy">repositories {
293+
maven {
294+
url "https://css4j.github.io/maven/"
295+
mavenContent {
296+
releasesOnly()
297+
}
298+
content {
299+
includeGroup 'io.sf.carte'
300+
includeGroup 'io.sf.jclf'
301+
includeGroup 'xmlpull'
302+
includeGroup 'xpp3'
303+
}
304+
}
305+
}
306+
</code></pre>
307+
<p>Same with Apache Maven:</p>
286308
<pre class="code"><code class="language-xml">&lt;dependency&gt;
287309
&lt;groupId&gt;io.sf.carte&lt;/groupId&gt;
288310
&lt;artifactId&gt;css4j-dom4j&lt;/artifactId&gt;
289311
&lt;version&gt;${css4jDom4j.version}&lt;/version&gt;
290312
&lt;/dependency&gt;
291313
</code></pre>
314+
<p>Again, please keep in mind adding css4j's Maven repository to your POM file:
315+
</p>
316+
<pre class="code"><code class="language-xml">&lt;repositories&gt;
317+
&lt;repository&gt;
318+
&lt;id&gt;css4j&lt;/id&gt;
319+
&lt;name&gt;CSS4J repository&lt;/name&gt;
320+
&lt;url&gt;https://css4j.github.io/maven/&lt;/url&gt;
321+
&lt;/repository&gt;
322+
&lt;/repositories&gt;
323+
</code></pre>
292324
<p>The <code>css4j-dom4j</code> artifact transitively implies the <code>css4j</code> core module, but since both artifacts have
293325
different release cycles you may want to add an explicit dependency for the core module, with the latest version.</p>
294326
<p>As explained in the <a href="#modules">modules section</a>, recent <code>css4j-dom4j</code> artifacts are compatible with <code>css4j</code>
295327
artifacts that have the same major version number, for example both <code>css4j-dom4j</code> 3.5.2 and 3.6.0 are compatible with
296-
<code>css4j</code> 3.7.0.</p>
328+
<code>css4j</code> 3.9.1.</p>
297329
<h3 class="subtema" id="dom4j-parsing">Loading and parsing an XML document</h3>
298330
<p>This is the easiest way to parse an XML document to use this package with DOM4J, using that library's <code>SAXReader</code>:</p>
299331
<pre class="code"><code class="language-java">SAXReader reader = new SAXReader(XHTMLDocumentFactory.getInstance());

0 commit comments

Comments
 (0)