How to use Xeger lib with maven

Published by Igor Khrupin on

It will be useful for you if you need to get text which can be match with your existing regular expression in JAVA.

Recently a had same question. I use Xeger (http://code.google.com/p/xeger/).

First of all you need to download JAR from http://code.google.com/p/xeger/.

Next you need to run in command line next command:

mvn install:install-file -Dfile=~/Downloads/xeger-1.0-SNAPSHOT.jar -DgroupId=nl.flotsam -DartifactId=xeger -Dversion=1.0-SNAPSHOT -Dpackaging=jar

There is linux-path to JAR file (~/Downloads/xeger-1.0-SNAPSHOT.jar). groupId, artifactId, version …. for xeger-1.0-SNAPSHOT.jar file. If you use another you need make some changes in command.

Next you need to copy JAR file in to .m2/repository/nl/flotsam/xeger/1.0-SNAPSHOT dir

in order to use Xeger you need also install in maven repository the dk.brics.automaton package.

Here part of my pom.xml:

<dependency>
    <groupid>nl.flotsam</groupid>
    <artifactid>xeger</artifactid>
    <version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
    <groupid>dk.brics</groupid>
    <artifactid>automaton</artifactid>
    <version>1.11</version>
</dependency>

If you have some questions you can create a comment for this post.

Have a nice codding!


2 Comments

Dima · 17 May, 2012 at 14:33

I have’ copied and pasted your part of pom.xml and I can see that following error in console:

5/17/12 7:30:05 AM CDT: [WARN] The POM for nl.flotsam:xeger:jar:1.0-SNAPSHOT is missing, no dependency information available
5/17/12 7:30:05 AM CDT: [WARN] The POM for dk.brics:automaton:jar:1.11 is missing, no dependency information available
5/17/12 7:30:05 AM CDT: Missing artifact nl.flotsam:xeger:jar:1.0-SNAPSHOT:compile
5/17/12 7:30:05 AM CDT: Missing artifact dk.brics:automaton:jar:1.11:compile

Thanks,
Dima

devops online training in hydeabad · 5 July, 2017 at 06:22

Wow. That is so elegant and logical and clearly explained. Keep it up! I follow up your blog for future post.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.