Subject: [bug#29359] [PATCH 02/31] gnu: Add java-jsoup.

From: Julien Lepiller <[email-masked]>
Date: Sun, 19 Nov 2017 18:57:36 +0100

* gnu/packages/java.scm (java-jsoup): New variable.
---
 gnu/packages/java.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 3ddfba08f..d8f9a7456 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -7504,3 +7504,42 @@ Objects into their JSON representation.  It can also be used to convert a JSON
 string to an equivalent Java object.  Gson can work with arbitrary Java objects
 including pre-existing objects that you do not have source-code of.")
     (license license:asl2.0)))
+
+(define-public java-jsoup
+  (package
+    (name "java-jsoup")
+    (version "1.10.3")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/jhy/jsoup/archive/jsoup-"
+                                  version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0xbzw7rjv7s4nz1xk9b2cnin6zkpaldmc3svk71waa7hhjgp0a20"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "jsoup.jar"
+       #:source-dir "src/main/java"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'copy-resources
+           (lambda _
+             (let ((classes-dir (string-append (getcwd) "/build/classes")))
+               (with-directory-excursion "src/main/java"
+                 (for-each (lambda (file)
+                             (let ((dist (string-append classes-dir "/" file)))
+                               (mkdir-p (dirname dist))
+                               (copy-file file dist)))
+                   (find-files "." ".*.properties"))))
+             #t)))))
+    (native-inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)
+       ("java-gson" ,java-gson)))
+    (home-page "https://jsoup.org")
+    (synopsis "HTML Parser")
+    (description "Jsoup is a Java library for working with real-world HTML.  It
+provides a very convenient API for extracting and manipulating data, using the
+best of DOM, CSS, and jquery-like methods.")
+    (license license:expat)))
-- 
2.15.0