Hi

I am working on a maven project on NetBeans and binding it in jar using
Maven Jar plugin.
While working on NetBeans the project runs fine, but when I run its .jar
file its gives the following error

Exception in thread "main" java.lang.NoClassDefFoundError:
org/elasticsearch/index/query/QueryBuilder
    at org.dbpedia.keywordsearch.uinterface.uiclass.main(uiclass.java:31)
Caused by: java.lang.ClassNotFoundException

Now I know it is because of class path. I tried to edit the class path with
the default local repository of maven but still it shows the same error.

My pom file looks like this:

 <modelVersion>4.0.0</modelVersion>
    <groupId>org</groupId>
    <artifactId>KeywordSearch</artifactId>
    <version>1.0.0</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>0.20.6</version>
        </dependency>
     </dependencies>
     <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
     </properties>
     <build>
         <plugins>
          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                 <configuration>
                 <archive>
                  <manifest>

<mainClass>org.keywordsearch.uinterface.uiclass</mainClass>
                       <addClasspath>true</addClasspath>

<classpathPrefix>/home/enigmatus/.m2/repository/</classpathPrefix>
                   </manifest>
                  </archive>
                </configuration>
            </plugin>
          </plugins>
    </build>

Can anybody tell me where I am going wrong.
Also I have to deploy my project, so how to change the path of default
local repository of maven dependencies where they are saved and then I can
access the dependencies using class-path from there.

Thanks
Cheers
Kartik

Reply via email to