Java Ivy / Maven to create dependencies for LucidWorks for automatic tokenizer phrases

I am inexperienced in creating Java projects and I am trying to create a tokenizer for Solr (here: https://github.com/LucidWorks/auto-phrase-tokenfilter ). While compiling, I get an unsolvable dependency message. Invalid dependencies are org.restlet and org.restlet.servlet. The repository for them is here: http://maven.restlet.com/org/restlet/jee/org.restlet/2.1.1/ . Ant / Ivy / Maven seems to be looking at repo1.maven.org to find interdependencies instead. I'm not sure how to get the ivy to look in the right place to find them.

I tried to load the restyle manually, but I'm not sure where to put the jar files. It looks like somewhere in / usr / share / maven -repository /, but I had no luck putting them there, and I'm not sure if ww> w40> / ivy / maven would look there, them there, in any location.

Any help or guidance would be appreciated.

Here's the build output:

root@solrtest:/usr/src/auto-phrase-tokenfilter# ant
Buildfile: /usr/src/auto-phrase-tokenfilter/build.xml

init:

ivy-download:

ivy-init:

ivy-resolve:
[ivy:resolve] :: Apache Ivy 2.3.0 - 20130110142753 :: http://ant.apache.org/ivy/ ::
[ivy:resolve] :: loading settings :: file = /usr/src/auto-phrase-tokenfilter/ivy/ivy-settings.xml
[ivy:resolve] :: resolving dependencies :: com.lucidworks.demo#autophrase-tokenfilter;working@solrtest
[ivy:resolve]   confs: [default, compile, test]
[ivy:resolve]   found org.apache.lucene#lucene-analyzers-common;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-core;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-codecs;4.10.3 in central
[ivy:resolve]   found org.apache.solr#solr-core;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-analyzers-kuromoji;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-analyzers-phonetic;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-expressions;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-grouping;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-highlighter;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-join;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-memory;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-misc;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-queries;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-queryparser;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-spatial;4.10.3 in central
[ivy:resolve]   found org.apache.lucene#lucene-suggest;4.10.3 in central
[ivy:resolve]   found org.apache.solr#solr-solrj;4.10.3 in central
[ivy:resolve]   found commons-io#commons-io;2.3 in central
[ivy:resolve]   found org.apache.httpcomponents#httpclient;4.3.1 in central
[ivy:resolve]   found org.apache.httpcomponents#httpcore;4.3 in central
[ivy:resolve]   found org.apache.httpcomponents#httpmime;4.3.1 in central
[ivy:resolve]   found org.apache.zookeeper#zookeeper;3.4.6 in central
[ivy:resolve]   found org.codehaus.woodstox#wstx-asl;3.2.7 in central
[ivy:resolve]   found org.noggit#noggit;0.5 in central
[ivy:resolve]   found org.slf4j#slf4j-api;1.7.6 in central
[ivy:resolve]   found com.carrotsearch#hppc;0.5.2 in central
[ivy:resolve]   found com.google.guava#guava;14.0.1 in central
[ivy:resolve]   found com.google.protobuf#protobuf-java;2.5.0 in central
[ivy:resolve]   found com.googlecode.concurrentlinkedhashmap#concurrentlinkedhashmap-lru;1.2 in central
[ivy:resolve]   found com.spatial4j#spatial4j;0.4.1 in central
[ivy:resolve]   found commons-cli#commons-cli;1.2 in central
[ivy:resolve]   found commons-codec#commons-codec;1.9 in central
[ivy:resolve]   found commons-configuration#commons-configuration;1.6 in central
[ivy:resolve]   found commons-fileupload#commons-fileupload;1.2.1 in central
[ivy:resolve]   found commons-lang#commons-lang;2.6 in central
[ivy:resolve]   found dom4j#dom4j;1.6.1 in central
[ivy:resolve]   found joda-time#joda-time;2.2 in central
[ivy:resolve]   found log4j#log4j;1.2.17 in central
[ivy:resolve]   found org.antlr#antlr-runtime;3.5 in central
[ivy:resolve]   found org.apache.hadoop#hadoop-annotations;2.2.0 in central
[ivy:resolve]   found org.apache.hadoop#hadoop-auth;2.2.0 in central
[ivy:resolve]   found org.apache.hadoop#hadoop-common;2.2.0 in central
[ivy:resolve]   found org.apache.hadoop#hadoop-hdfs;2.2.0 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-continuation;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-deploy;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-http;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-io;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-jmx;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-security;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-server;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-servlet;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-util;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-webapp;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty#jetty-xml;8.1.10.v20130312 in central
[ivy:resolve]   found org.eclipse.jetty.orbit#javax.servlet;3.0.0.v201112011016 in central
[ivy:resolve]   found org.ow2.asm#asm;4.1 in central
[ivy:resolve]   found org.ow2.asm#asm-commons;4.1 in central
[ivy:resolve]   found org.apache.lucene#lucene-test-framework;4.10.3 in central
[ivy:resolve]   found com.carrotsearch.randomizedtesting#junit4-ant;2.1.6 in central
[ivy:resolve]   found com.carrotsearch.randomizedtesting#randomizedtesting-runner;2.1.6 in central
[ivy:resolve]   found junit#junit;4.10 in central
[ivy:resolve]   found org.apache.ant#ant;1.8.2 in central
[ivy:resolve]   found org.apache.solr#solr-test-framework;4.10.3 in central
[ivy:resolve] :: resolution report :: resolve 8098ms :: artifacts dl 47ms
        ---------------------------------------------------------------------
        |                  |            modules            ||   artifacts   |
        |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
        ---------------------------------------------------------------------
        |      default     |   59  |   0   |   0   |   0   ||   57  |   0   |
        |      compile     |   59  |   0   |   0   |   0   ||   57  |   0   |
        |       test       |   65  |   0   |   0   |   0   ||   63  |   0   |
        ---------------------------------------------------------------------
[ivy:resolve]
[ivy:resolve] :: problems summary ::
[ivy:resolve] :::: WARNINGS
[ivy:resolve]           module not found: org.restlet.jee#org.restlet;2.1.1
[ivy:resolve]   ==== central: tried
[ivy:resolve]     http://repo1.maven.org/maven2/org/restlet/jee/org.restlet/2.1.1/org.restlet-2.1.1.pom
[ivy:resolve]     -- artifact org.restlet.jee#org.restlet;2.1.1!org.restlet.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/org/restlet/jee/org.restlet/2.1.1/org.restlet-2.1.1.jar
[ivy:resolve]           module not found: org.restlet.jee#org.restlet.ext.servlet;2.1.1
[ivy:resolve]   ==== central: tried
[ivy:resolve]     http://repo1.maven.org/maven2/org/restlet/jee/org.restlet.ext.servlet/2.1.1/org.restlet.ext.servlet-2.1.1.pom
[ivy:resolve]     -- artifact org.restlet.jee#org.restlet.ext.servlet;2.1.1!org.restlet.ext.servlet.jar:
[ivy:resolve]     http://repo1.maven.org/maven2/org/restlet/jee/org.restlet.ext.servlet/2.1.1/org.restlet.ext.servlet-2.1.1.jar
[ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]           ::          UNRESOLVED DEPENDENCIES         ::
[ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]           :: org.restlet.jee#org.restlet;2.1.1: not found
[ivy:resolve]           :: org.restlet.jee#org.restlet.ext.servlet;2.1.1: not found
[ivy:resolve]           ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:resolve]
[ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED
/usr/src/auto-phrase-tokenfilter/build.xml:115: impossible to resolve dependencies:
        resolve failed - see output for details

Total time: 9 seconds

      

build.xml

<project name="auto-phrase-tokenfilter" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" >
  <description>Builds Autophrasing Token Filter</description>

  <!-- set global properties for this build -->
  <property name="build.dir" location="build"/>
  <property name="dist.dir"  location="dist"/>
  <property name="build.lib.dir" value="${basedir}/build-lib"/>

  <property name="src.dir" location="src/main/java"/>
  <property name="classes.dir" location="${build.dir}/java" />
  <property name="test.dir" location="src/test" />
  <property name="test.classes.dir" location="${build.dir}/test" />

  <property name="ivy.dir" location="${basedir}/ivy"/>
  <property name="ivy.dep.file" location="ivy.xml" />
  <property name="ivy.version" value="2.3.0"/>
  <property name="ivy.lib.dir"  location="${build.lib.dir}/ivy/lib" />

  <property name="project.name" value="${ant.project.name}" />
  <property name="version.number" value="1.0"/>

  <!-- change this to include ivy download dest -->
  <target name="set-classpaths" depends="ivy-retrieve" >
    <path id="compile-classpath" >
      <fileset dir="${ivy.lib.dir}/compile" includes="*.jar"/>
    </path>

    <path id="test-classpath">
      <fileset dir="${ivy.lib.dir}/test" includes="*.jar"/>
    </path>
  </target>

  <target name="init">
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${classes.dir}"/>
    <mkdir dir="${test.classes.dir}"/>
  </target>

  <target name="compile" depends="init,ivy-retrieve,set-classpaths" description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false" >
      <classpath>
        <fileset dir="${ivy.lib.dir}" includes="compile/*.jar" />
      </classpath>
    </javac>
  </target>

  <target  name="compile-test" depends="compile" >
    <javac srcdir="${test.dir}" destdir="${test.classes.dir}" includeantruntime="false" >
      <classpath>
        <fileset dir="${ivy.lib.dir}" includes="test/*.jar" />
        <pathelement location="${classes.dir}" />
      </classpath>
    </javac>
  </target>

  <target name="dist" depends="compile,test" description="generate the distribution" >
    <!-- Create the distribution directory -->
    <ivy:resolve/>
    <mkdir dir="${classes.dir}"/>
    <jar jarfile="${dist.dir}/${project.name}-${version.number}.jar" basedir="${classes.dir}"/>
    <!-- Add JavaDocs -->

  </target>

  <target name="clean" description="clean up" >
    <!-- Delete the ${build.dir} and ${dist.dir} directory trees -->
    <ivy:cleancache/>
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}"/>
    <delete dir="${ivy.lib.dir}"/>
  </target>

  <target name="test" depends="compile,compile-test">
    <echo message=""/>
    <junit printsummary="yes" fork="yes" haltonfailure="yes">
      <formatter usefile="false" type="plain"/>
      <classpath>
        <path refid="test-classpath"/>
        <pathelement location="${classes.dir}"/>
        <pathelement location="${test.classes.dir}" />
      </classpath>
      <assertions>
        <enable/>
      </assertions>
      <test name="com.lucidworks.analysis.TestAutoPhrasingTokenFilter"/>
    </junit>
  </target>

  <!-- Ivy -->
  <condition property="ivy.jar.exists">
    <or>
      <available file="${build.lib.dir}/ivy-${ivy.version}.jar"/>
      <isset property="offline"/>
    </or>
  </condition>

  <target name="ivy-download" unless="ivy.jar.exists">
    <mkdir dir="${build.lib.dir}"/>
    <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
         dest="${build.lib.dir}/ivy-${ivy.version}.jar"
         usetimestamp="true"/>
  </target>

  <target name="ivy-init" depends="ivy-download" unless="skip.ivy" description="initialize ivy">
    <path id="ivy.lib.path">
      <fileset dir="${build.lib.dir}" includes="ivy-${ivy.version}.jar"/>
    </path>
    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
    <ivy:settings file="${ivy.dir}/ivy-settings.xml"/>
  </target>

  <target name="ivy-resolve" depends="ivy-init" >
    <ivy:resolve />
  </target>

  <target name="ivy-retrieve" depends="ivy-resolve" >
    <ivy:retrieve pattern="${ivy.lib.dir}/[conf]/[artifact]-[revision].[ext]" sync="true" />
  </target>

</project>

      

ivy / ivy settings.xml:

<ivysettings>
    <settings defaultResolver="central"/>
    <resolvers>
        <ibiblio name="central" m2compatible="true"/>
    </resolvers>
</ivysettings>

      

+3


source to share


2 answers


Here's what I did to solve the dependency problem. I'm not sure which of the modules I configured is the one picking up the dependency. Chaining is what it did, although it will process the repositories in the order they are listed.



<ivysettings>
    <settings defaultResolver="my-chain"/>
    <resolvers>
        <chain name="my-chain">
                <ibiblio name="restlet" m2compatible="true" root="http://maven.restlet.com"/>
                <ibiblio name="central" m2compatible="true"/>
        </chain>
    </resolvers>
    <modules>
        <module organization="org.restlet.jee" resolver="restlet"/>
        <module organization="restlet" resolver="restlet"/>
        <module organization="org.restlet" resolver="restlet"/>
    </modules>
</ivysettings>

      

+4


source


I had the same error, problem updating with Ivy. It turns out I canceled the previous build halfway through, and in the ~ / .ivy2 / cache directory, the artifact had XML metadata but no jars. I deleted the directory in the cache and that fixed the problem for me.



+1


source







All Articles