Giter Site home page Giter Site logo

Comments (67)

bpossolo avatar bpossolo commented on July 21, 2024 10

I am pleased to announce that uap-java is now published to Maven Central Repository for the first time ever.

<groupId>com.github.ua-parser</groupId>
<artifactId>uap-java</artifactId>
<version>1.4.0</version>
<packaging>jar</packaging>

This includes the latest regexes.yaml file and I fixed the tests to pass with the new file.

I also bumped the dependencies to the latest versions.

org.yaml.snakeyaml: 1.20
org.apache.commons.commons-collections4: 4.1

from uap-java.

bpossolo avatar bpossolo commented on July 21, 2024 3

I've requested a namespace on Maven Central repo.

group id: com.github.ua-parser
artifact id: uap-java

screen shot 2018-05-09 at 1 28 46 am

from uap-java.

kdekooter avatar kdekooter commented on July 21, 2024 2

Hang on guys, not so fast! The issue says "Publish the JAVA Library to Maven". That's what I - and I suppose a lot of other commenter - +1-ed this issue for. So please reopen the issue. I am actively using the java version of ua-parser.

from uap-java.

kdekooter avatar kdekooter commented on July 21, 2024 2

@jogjayr I would prefer using the ua-parser library in its Java incarnation. Having to pull clojure in for such a small part of logic feels a bit bloated.

from uap-java.

nkavian avatar nkavian commented on July 21, 2024 2

Please refer to my comment that is now buried under this Clojure conversation. You can use JitPack.io to get the Jar as a Maven artifact.

#1 (comment)

And another comment showing how to download fresh copies of the YAML file.

#1 (comment)

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024 1

@dzlab @edvasqueza hasn't happened in 18 months, probably won't happen unless you do it yourself. In the meantime, there's a Clojure implementation you can pull into your project; add these stanzas to your pom.xml:

<repository>
  <id>clojars</id>
  <url>http://clojars.org/repo/</url>
</repository>
<dependency>
  <groupId>uap-clj</groupId>
  <artifactId>uap-clj</artifactId>
  <version>1.1.2</version>
</dependency>

Then you can call natively from your own java code easily, because I hid the (still rather trivial) interop details in some convenience wrappers I wrote for Java programmers:

package useragent;

import java.util.HashMap;

// Java API for uap-clj Clojure implementation of useragent parser
import uap_clj.java.api.*;

public class Parser {
  public Parser() {};

  public static void main(String[] args) {
    String ua = args[0];

    HashMap b = Browser.lookup(ua);
    HashMap o = OS.lookup(ua);
    HashMap d = Device.lookup(ua);

    System.out.println("Browser family: " + b.get("family"));
    System.out.println("Browser major number: " + b.get("major"));
    System.out.println("Browser minor number: " + b.get("minor"));
    System.out.println("Browser patch number: " + b.get("patch"));

    System.out.println("O/S family: " + o.get("family"));
    System.out.println("O/S major number: " + o.get("major"));
    System.out.println("O/S minor number: " + o.get("minor"));
    System.out.println("O/S patch number: " + o.get("patch"));
    System.out.println("O/S patch_minor number: " + o.get("patch_minor"));

    System.out.println("Device family: " + d.get("family"));
    System.out.println("Device brand: " + d.get("brand"));
    System.out.println("Device model: " + d.get("model"));
  }
}

Hope this helps.

from uap-java.

asafm avatar asafm commented on July 21, 2024 1

@russellwhitaker - The core code hasn't really changed so it's ok that it's over a year old. What we do in our project is pull the latest yaml file and use it, and not the one bundled in the jar. We use the following maven snippet to do it:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>download-files</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <!--User Agent processor regexes file (download from github by commit id)-->
                                <get src="https://raw.githubusercontent.com/ua-parser/uap-core/0dabfd35a465e1c7dd5b07c273d4b693d46ee387/regexes.yaml"
                                     dest="${project.build.outputDirectory}/regexes.yaml" />                                
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Once in a while we update the commit ID above to be the latest after we tested it locally.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024 1

An alternative is to use uap-clj, which is actively maintained. In fact, I wrote it because this Java repo isn't actively maintained. Add this to your pom.xml:

<repository>
  <id>clojars</id>
  <url>http://clojars.org/repo/</url>
</repository>

So you can pull in this dependency:

<dependency>
  <groupId>org.clojure</groupId>
  <artifactId>clojure</artifactId>
  <version>1.8.0</version>
</dependency>
<dependency>
  <groupId>uap-clj</groupId>
  <artifactId>uap-clj</artifactId>
  <version>1.3.1</version>
</dependency>

Example usage:

package useragent;

import java.util.HashMap;

// Java API for uap-clj Clojure implementation of useragent parser
import uap_clj.java.api.*;

public class Parser {
  public Parser() {};

  public static void main(String[] args) {
    String ua = args[0];

    HashMap b = Browser.lookup(ua);
    HashMap o = OS.lookup(ua);
    HashMap d = Device.lookup(ua);

    System.out.println("Browser family: " + b.get("family"));
    System.out.println("Browser major number: " + b.get("major"));
    System.out.println("Browser minor number: " + b.get("minor"));
    System.out.println("Browser patch number: " + b.get("patch"));

    System.out.println("O/S family: " + o.get("family"));
    System.out.println("O/S major number: " + o.get("major"));
    System.out.println("O/S minor number: " + o.get("minor"));
    System.out.println("O/S patch number: " + o.get("patch"));
    System.out.println("O/S patch_minor number: " + o.get("patch_minor"));

    System.out.println("Device family: " + d.get("family"));
    System.out.println("Device brand: " + d.get("brand"));
    System.out.println("Device model: " + d.get("model"));
  }
}

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

+1

from uap-java.

magicknot avatar magicknot commented on July 21, 2024

+1 as well

from uap-java.

sdboer78 avatar sdboer78 commented on July 21, 2024

+1

from uap-java.

MaximumDamage avatar MaximumDamage commented on July 21, 2024

+1
I guess maven is the way to go with java in general

from uap-java.

kdekooter avatar kdekooter commented on July 21, 2024

👍

from uap-java.

OuIChien avatar OuIChien commented on July 21, 2024

+1 as well

from uap-java.

vnydvd avatar vnydvd commented on July 21, 2024

If this gets closed, it will be great. Maven will be nice

from uap-java.

TheSavior avatar TheSavior commented on July 21, 2024

👍

from uap-java.

cgi avatar cgi commented on July 21, 2024

+1 for such artifact in Maven Central

from uap-java.

dennismaassnp avatar dennismaassnp commented on July 21, 2024

+1

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

@jogjayr I'm not sure this is ever going to happen: this Java language repo, while having been preserved after the split/migration to the ua-parser github org, doesn't seem to be actively maintained since the split (latest commit was about 5 months ago). In the meantime, if you need Clojure functionality for doing useragent parsing, I've just released v1.0.0 of uap-clj:

https://clojars.org/uap-clj

Associated repo: https://github.com/russellwhitaker/uap-clj

Hope you find it useful.

from uap-java.

jogjayr avatar jogjayr commented on July 21, 2024

@russellwhitaker Nice! I personally don't need this functionality any more. Since there's now a good alternative for Clojure (thanks for that!), I'll close this issue.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

My pleasure @jogjayr . Feel free to post issues on that Clojure version's repo, I'm happy to consider PRs and issues. I might even consider checking with @elsigh and asking if they'd be interested in forking the now-feature-complete and fully-specification-compliant Clojure implementation to the ua-parser org.

from uap-java.

Daenyth avatar Daenyth commented on July 21, 2024

I'm using the java one as well

On Thu, Jun 4, 2015, 02:43 Kees de Kooter [email protected] wrote:

Hang on guys, not so fast! The issue says "Publish the JAVA Library to
Maven". That's what I - and I suppose a lot of other commenter - +1-ed this
issue for. So please reopen the issue. I am actively using the java version
of ua-parser.


Reply to this email directly or view it on GitHub
#1 (comment).

from uap-java.

absynthe avatar absynthe commented on July 21, 2024

Same here.

from uap-java.

jogjayr avatar jogjayr commented on July 21, 2024

All right. Clearly I misunderstood why this was a popular issue :-) . I thought it was the Clojure thing.

I'll reopen it.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

The lack of a Java Maven artifact was one of the inputs to my having decided to write the Clojure version and publish a Maven-accessible artifact to Clojars. :)

from uap-java.

iToto avatar iToto commented on July 21, 2024

👍 Would definitely profit from the Maven availability

from uap-java.

belbis avatar belbis commented on July 21, 2024

is there a reason this issue is being ignored? pushing to maven central repo would make it a lot easier to incorporate into projects...

from uap-java.

nkavian avatar nkavian commented on July 21, 2024

+1

from uap-java.

BaiGang avatar BaiGang commented on July 21, 2024

+1 as well.

from uap-java.

fbaligand avatar fbaligand commented on July 21, 2024

+1
this is necessary for every opensource library.
I don't understand why this library is not yet on maven central.

No maven java project can use this library until it is published on maven central.

from uap-java.

tmatei avatar tmatei commented on July 21, 2024

any updates on this?

from uap-java.

alexnederlof avatar alexnederlof commented on July 21, 2024

👍

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

I doubt this is ever going to happen, given the apparent negligence of uap-java by its maintainers. However, I have a workaround for you guys. Add this to your pom.xml:

    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>clojure</artifactId>
      <version>1.7.0</version>
    </dependency>
    <dependency>
      <groupId>uap-clj</groupId>
      <artifactId>uap-clj</artifactId>
      <version>1.0.3</version>
    </dependency>

This means that my own Clojure implementation uap-clj does have a maven artifact available, and you can use it in your Java code with a little bit of Clojure Java interop magic. I whipped up an example for Java developers:

package useragent;

import java.util.HashMap;

// Core clojure libraries
import clojure.java.api.Clojure;
import clojure.lang.IFn;
import clojure.lang.PersistentArrayMap;

// uap-clj Clojure implementation of useragent parser
import uap_clj.core.*;

public class Parser {
  private IFn require;
  private IFn keyword;

  public Parser() {
    require = Clojure.var("clojure.core", "require");
    keyword = Clojure.var("clojure.core", "keyword");
    require.invoke(Clojure.read("uap_clj.core"));
  };

  public PersistentArrayMap doLookup(String useragent) {
    IFn lookup = Clojure.var("uap-clj.core", "lookup-useragent");
    return (PersistentArrayMap)lookup.invoke(useragent);
  }

  public HashMap getBrowser(PersistentArrayMap useragent) {
    HashMap browser = new HashMap();

    PersistentArrayMap b = (PersistentArrayMap)useragent.valAt(keyword.invoke("browser"));

    browser.put("family", b.valAt(keyword.invoke("family")));
    browser.put("major",  b.valAt(keyword.invoke("major")));
    browser.put("minor",  b.valAt(keyword.invoke("minor")));
    browser.put("patch", b.valAt(keyword.invoke("patch")));

    return browser;
  }

  public HashMap getOS(PersistentArrayMap useragent) {
    HashMap os = new HashMap();

    PersistentArrayMap o = (PersistentArrayMap)useragent.valAt(keyword.invoke("os"));

    os.put("family", o.valAt(keyword.invoke("family")));
    os.put("major",  o.valAt(keyword.invoke("major")));
    os.put("minor",  o.valAt(keyword.invoke("minor")));
    os.put("patch",  o.valAt(keyword.invoke("patch")));
    os.put("patch_minor", o.valAt(keyword.invoke("patch_minor")));

    return os;
  }

  public HashMap getDevice(PersistentArrayMap useragent) {
    HashMap device = new HashMap();

    PersistentArrayMap d = (PersistentArrayMap)useragent.valAt(keyword.invoke("device"));

    device.put("family", d.valAt(keyword.invoke("family")));
    device.put("brand",  d.valAt(keyword.invoke("brand")));
    device.put("model",  d.valAt(keyword.invoke("model")));

    return device;
  }

  public static void main(String[] args) {
    Parser p = new Parser();

    PersistentArrayMap ua = p.doLookup(args[0]);

    HashMap b = p.getBrowser(ua);
    HashMap o = p.getOS(ua);
    HashMap d = p.getDevice(ua);

    System.out.println("Browser family: " + b.get("family"));
    System.out.println("Browser major number: " + b.get("major"));
    System.out.println("Browser minor number: " + b.get("minor"));
    System.out.println("Browser patch number: " + b.get("patch"));

    System.out.println("O/S family: " + o.get("family"));
    System.out.println("O/S major number: " + o.get("major"));
    System.out.println("O/S minor number: " + o.get("minor"));
    System.out.println("O/S patch number: " + o.get("patch"));
    System.out.println("O/S patch_minor number: " + o.get("patch_minor"));

    System.out.println("Device family: " + d.get("family"));
    System.out.println("Device brand: " + d.get("brand"));
    System.out.println("Device model: " + d.get("model"));
  }
}

Do a mvn compile, then:

→ mvn exec:java -Dexec.mainClass="useragent.Parser" -Dexec.args="'Lenovo-A288t_TD/S100 Linux/2.6.35 Android/2.3.5 Release/02.29.2012 Browser/AppleWebkit533.1 Mobile Safari/533.1 FlyFlow/1.4'"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UapJavaWrapper 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ UapJavaWrapper ---
Browser family: Baidu Explorer
Browser major number: 1
Browser minor number: 4
Browser patch number:
O/S family: Android
O/S major number: 2
O/S minor number: 3
O/S patch number: 5
O/S patch_minor number:
Device family: Lenovo A288t_TD
Device brand: Lenovo
Device model: A288t_TD
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.978 s
[INFO] Finished at: 2015-11-01T18:11:50-08:00
[INFO] Final Memory: 15M/298M
[INFO] ------------------------------------------------------------------------

Please try this approach and let me know if it's useful to you guys. If there's interest, I can re-write uap-clj to 1.) allow separate browser, o/s, and device lookup (presently, everything gets looked up by the public interace and 2.) eliminates the need for Java programmers to do any special interop setup in their code. Let me know.

from uap-java.

nkavian avatar nkavian commented on July 21, 2024

Try this:

    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>

and

    <dependency>
        <groupId>com.github.ua-parser</groupId>
        <artifactId>uap-java</artifactId>
        <version>8f138347c0</version>
    </dependency>

For more info: https://jitpack.io/#ua-parser/uap-java/8f138347c0

from uap-java.

nkavian avatar nkavian commented on July 21, 2024

Too bad uap-core isn't structured in a way to bring in the regexes file easily via maven..

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

@nkavian yes, that fact caused me no end of trouble during my development of uap-clj. I keep having to use a plugin to pull in regexes.yaml when I do new builds.

from uap-java.

nkavian avatar nkavian commented on July 21, 2024

To share how I solved it, I keep a local copy for development and refresh it using the plugin below during maven packaging:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <get src="https://github.com/ua-parser/uap-core/raw/master/regexes.yaml"
                     dest="${project.build.directory}/classes/yaml/regexes2.yaml"
                     verbose="true" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

@nkavian by the way, am I the only bothered by the fact there are no unit tests on uap-java?

from uap-java.

nkavian avatar nkavian commented on July 21, 2024

@russellwhitaker Stuff happens sometimes :)

Just took a look, did you miss this folder? https://github.com/ua-parser/uap-java/tree/master/src/test/java/ua_parser

If the code is clean, tests are a lower priority on such a small project. But imho, I was more bothered by the Parser constructor throwing an IOException. If the user doesn't have the required file in the right place, then wrap the exception and throw a RuntimeException.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

@nkavian ah right, I'm used to src and test being parallel nowadays; forgot my old maven conventions there.

Yeah, that Parser constructor issue bugged me too when I first saw it.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

OK, I've written a Java API wrapper around uap-clj and published to Clojars. This means Java programmers can call this Clojure library without having to learn any special interop incantations.

Add this repository to your pom.xml:

<repository>
  <id>clojars</id>
  <url>http://clojars.org/repo/</url>
</repository>

Then add these dependencies to your pom.xml:

<dependency>
  <groupId>org.clojure</groupId>
  <artifactId>clojure</artifactId>
  <version>1.7.0</version>
</dependency>
<dependency>
  <groupId>uap-clj</groupId>
  <artifactId>uap-clj</artifactId>
  <version>1.1.0</version>
</dependency>

Example usage:

package useragent;

import java.util.HashMap;

// Java API for uap-clj Clojure implementation of useragent parser
import uap_clj.java.api.*;

public class Parser {
  public Parser() {};

  public static void main(String[] args) {
    String ua = args[0];

    HashMap b = Browser.lookup(ua);
    HashMap o = OS.lookup(ua);
    HashMap d = Device.lookup(ua);

    System.out.println("Browser family: " + b.get("family"));
    System.out.println("Browser major number: " + b.get("major"));
    System.out.println("Browser minor number: " + b.get("minor"));
    System.out.println("Browser patch number: " + b.get("patch"));

    System.out.println("O/S family: " + o.get("family"));
    System.out.println("O/S major number: " + o.get("major"));
    System.out.println("O/S minor number: " + o.get("minor"));
    System.out.println("O/S patch number: " + o.get("patch"));
    System.out.println("O/S patch_minor number: " + o.get("patch_minor"));

    System.out.println("Device family: " + d.get("family"));
    System.out.println("Device brand: " + d.get("brand"));
    System.out.println("Device model: " + d.get("model"));
  }
}
→ mvn compile
→ mvn exec:java -Dexec.mainClass="useragent.Parser" -Dexec.args="'Lenovo-A288t_TD/S100 Linux/2.6.35 Android/2.3.5 Release/02.29.2012 Browser/AppleWebkit533.1 Mobile Safari/533.1 FlyFlow/1.4'"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UapJavaWrapper 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ UapJavaWrapper ---
Browser family: Baidu Explorer
Browser major number: 1
Browser minor number: 4
Browser patch number:
O/S family: Android
O/S major number: 2
O/S minor number: 3
O/S patch number: 5
O/S patch_minor number:
Device family: Lenovo A288t_TD
Device brand: Lenovo
Device model: A288t_TD
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.961 s
[INFO] Finished at: 2015-11-03T14:39:45-08:00
[INFO] Final Memory: 15M/301M
[INFO] ------------------------------------------------------------------------

If anyone finds this useful, please let me know, thanks.

from uap-java.

jogjayr avatar jogjayr commented on July 21, 2024

Thanks Russell! That's awesome work!

People who have +1ed so far or future people who view this thread, if you
can let me know whether Russell's library meets your requirements, I'll
close this issue.
On Nov 3, 2015 3:03 PM, "Russell Whitaker" [email protected] wrote:

OK, I've written a Java API wrapper around uap-clj http://../../uap-clj
and published to Clojars. This means Java programmers can call this Clojure
library without having to learn any special interop incantations.

Add this repository to your pom.xml:

clojars http://clojars.org/repo/

Then add these dependencies to your pom.xml:

org.clojure clojure 1.7.0 uap-clj uap-clj 1.1.0

Example usage:

package useragent;
import java.util.HashMap;
// Java API for uap-clj Clojure implementation of useragent parserimport uap_clj.java.api.*;
public class Parser {
public Parser() {};

public static void main(String[] args) {
String ua = args[0];

HashMap b = Browser.lookup(ua);
HashMap o = OS.lookup(ua);
HashMap d = Device.lookup(ua);

System.out.println("Browser family: " + b.get("family"));
System.out.println("Browser major number: " + b.get("major"));
System.out.println("Browser minor number: " + b.get("minor"));
System.out.println("Browser patch number: " + b.get("patch"));

System.out.println("O/S family: " + o.get("family"));
System.out.println("O/S major number: " + o.get("major"));
System.out.println("O/S minor number: " + o.get("minor"));
System.out.println("O/S patch number: " + o.get("patch"));
System.out.println("O/S patch_minor number: " + o.get("patch_minor"));

System.out.println("Device family: " + d.get("family"));
System.out.println("Device brand: " + d.get("brand"));
System.out.println("Device model: " + d.get("model"));

}
}

→ mvn compile
→ mvn exec:java -Dexec.mainClass="useragent.Parser" -Dexec.args="'Lenovo-A288t_TD/S100 Linux/2.6.35 Android/2.3.5 Release/02.29.2012 Browser/AppleWebkit533.1 Mobile Safari/533.1 FlyFlow/1.4'"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UapJavaWrapper 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ UapJavaWrapper ---
Browser family: Baidu Explorer
Browser major number: 1
Browser minor number: 4
Browser patch number:
O/S family: Android
O/S major number: 2
O/S minor number: 3
O/S patch number: 5
O/S patch_minor number:
Device family: Lenovo A288t_TD
Device brand: Lenovo
Device model: A288t_TD
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.961 s
[INFO] Finished at: 2015-11-03T14:39:45-08:00
[INFO] Final Memory: 15M/301M
[INFO] ------------------------------------------------------------------------

If anyone finds this useful, please let me know, thanks.


Reply to this email directly or view it on GitHub
#1 (comment).

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

My pleasure @jogjayr . And if anyone has issues/requests for uap-clj, I will happily listen and incorporate feedback quickly.

from uap-java.

TheSavior avatar TheSavior commented on July 21, 2024

Agreed. I definitely don't want to have to use a clojure version of this library when everything else we do is just Java.

from uap-java.

TheSavior avatar TheSavior commented on July 21, 2024

@Ironholds It looks like you are the only person who has merged stuff to this repo recently. What is your take on this?

from uap-java.

Ironholds avatar Ironholds commented on July 21, 2024

To be perfectly honest I know very little about Maven; my perspective is as a (previous) maintainer of ua-parser as a whole. If pushing it up there would make the project more valuable, let me know what I can do to make that easier.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

It would be great if someone would push a Java lib jarfile to Maven Central, and if someone would help @Ironholds that would be cool. As for those who object to using the Java API to a Clojure library, that's also cool: I only wrote the Clojure implementation because I myself needed a Maven Central artifact as well a year ago, and no one provided one, so I wrote an implementation in a JVM language, added a Java-programmer-friendly API yesterday very similar to that of the native Java implementation, and gave instructions for its use.

I've updated the repository artifact again today with some performance enhancements, and anyone who cares can try it out:

<dependency>
  <groupId>uap-clj</groupId>
  <artifactId>uap-clj</artifactId>
  <version>1.1.1</version>
</dependency>

from uap-java.

kdekooter avatar kdekooter commented on July 21, 2024

Tests are failing for me:

testReplacementQuoting(ua_parser.ParserTest)  Time elapsed: 0.001 sec  <<< ERROR!
org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed
    at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:198)
    at org.yaml.snakeyaml.reader.StreamReader.<init>(StreamReader.java:62)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:411)
    at ua_parser.Parser.initialize(Parser.java:69)
    at ua_parser.Parser.<init>(Parser.java:44)
    at ua_parser.Parser.<init>(Parser.java:40)
    at ua_parser.ParserTest.initParser(ParserTest.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.io.IOException: Stream closed
    at java.io.PushbackInputStream.ensureOpen(PushbackInputStream.java:74)
    at java.io.PushbackInputStream.read(PushbackInputStream.java:166)
    at org.yaml.snakeyaml.reader.UnicodeReader.init(UnicodeReader.java:88)
    at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:118)
    at java.io.Reader.read(Reader.java:140)
    at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:182)
    ... 35 more

from uap-java.

fbaligand avatar fbaligand commented on July 21, 2024

A simple way to publish the uap-java to maven central repository, is to
follow this guide :
http://central.sonatype.org/pages/ossrh-guide.html

2015-11-05 8:55 GMT+01:00 Kees de Kooter [email protected]:

Tests are failing for me:

testReplacementQuoting(ua_parser.ParserTest) Time elapsed: 0.001 sec <<< ERROR!
org.yaml.snakeyaml.error.YAMLException: java.io.IOException: Stream closed
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:198)
at org.yaml.snakeyaml.reader.StreamReader.(StreamReader.java:62)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:411)
at ua_parser.Parser.initialize(Parser.java:69)
at ua_parser.Parser.(Parser.java:44)
at ua_parser.Parser.(Parser.java:40)
at ua_parser.ParserTest.initParser(ParserTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.io.IOException: Stream closed
at java.io.PushbackInputStream.ensureOpen(PushbackInputStream.java:74)
at java.io.PushbackInputStream.read(PushbackInputStream.java:166)
at org.yaml.snakeyaml.reader.UnicodeReader.init(UnicodeReader.java:88)
at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:118)
at java.io.Reader.read(Reader.java:140)
at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:182)
... 35 more


Reply to this email directly or view it on GitHub
#1 (comment).

from uap-java.

dzlab avatar dzlab commented on July 21, 2024

+1 will be great if this project is in maven central.

from uap-java.

edvasqueza avatar edvasqueza commented on July 21, 2024

+1 please publish it

from uap-java.

dzlab avatar dzlab commented on July 21, 2024

thanks for sharing @russellwhitaker

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

You are most welcome @dzlab

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

I have updated uap-clj to v1.2.0 now: https://github.com/ua-parser/uap-clj

from uap-java.

vidmantas-banaitis avatar vidmantas-banaitis commented on July 21, 2024

+1 publish it.

Also you can publish to https://bintray.com/ . Its free and a lot easier.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

I have updated uap-clj to v1.2.2 now: https://github.com/ua-parser/uap-clj

The Java wrapper API is available for use by Java programmers; see the README for instructions.

from uap-java.

cybertiger avatar cybertiger commented on July 21, 2024

+1 Please publish to maven central (and make a non-snapshot release in the process).

from uap-java.

asafm avatar asafm commented on July 21, 2024

The source files says Twitter copyright.
I also found version 1.3.0 in mvnrepository under Twitter Maven repo:
http://mvnrepository.com/artifact/ua_parser/ua-parser/1.3.0

I'll give it a go there.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

I've updated uap-clj to v1.3.0; as before, the Java wrapper API is available as well.

from uap-java.

asafm avatar asafm commented on July 21, 2024

We're using this for the past 3-4 weeks and it works flawlessly:
http://mvnrepository.com/artifact/ua_parser/ua-parser/1.3.0

            <dependency>
                <groupId>ua_parser</groupId>
                <artifactId>ua-parser</artifactId>
                <version>1.3.0</version>
            </dependency>

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

@asafm that's an old artifact (a little over a year); does it regress 100% against the current core regexes.yaml? Curious.

from uap-java.

fbacchella avatar fbacchella commented on July 21, 2024

I downloaded the artifact for twitter. In it the pom.properties says:

#Generated by Maven
#Mon Nov 18 14:49:18 PST 2013
version=1.3.0
groupId=ua_parser
artifactId=ua-parser

The URL in the build in the embedded pom.xml:

  <url>https://github.com/tobie/ua-parser/</url>

Looks like a very old build.

from uap-java.

asafm avatar asafm commented on July 21, 2024

from uap-java.

fbacchella avatar fbacchella commented on July 21, 2024

Yes it's the twitter maven repo that is too old. There has been some commit since November 2013.

from uap-java.

bpossolo avatar bpossolo commented on July 21, 2024

Is this project still maintained? If not, can someone transfer ownership?
I would like to get a new jar with the latest regexes.yaml file published to mvn central and am willing to do it myself if someone can hand it over.

from uap-java.

russellwhitaker avatar russellwhitaker commented on July 21, 2024

Attn. @commenthol

from uap-java.

fbaligand avatar fbaligand commented on July 21, 2024

Great news !

from uap-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.