Arun
Arun

Reputation: 2572

Import and use a class from a jar using Maven

I am trying to implement hoptoad in my existing maven project. I ve given the following lines in pom.xml as suggested in http://code.google.com/p/hoptoad/

<project>
  <repositories>
    <repository>
      <id>hoptoad-repository</id>
      <name>Hoptoad Repository</name>
      <url>http://hoptoad.googlecode.com/svn/maven2</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>code.lucamarrocco</groupId>
      <artifactId>hoptoad-notifier</artifactId>
      <version>1.8</version>
    </dependency>
  </dependencies>

</project>

When i try to use the HoptoadNotice in my catch block, i m getting ClassNotFoundException. I am using Eclipse IDE. I am not able to figure out, that the problem is because of inclusion of this code(in pom) or in the IDE. I can understand that the inclusion of these lines alone do not help the code to recognize the jar. So, i tried installing the jar in maven repository. But still it did not help.

Note:- I have not just blindly copied as shown above, directly into the pom.xml. I have included the lines of code wrt <dependencies> and <repositories> blocks.

Upvotes: 0

Views: 140

Answers (1)

Ralph
Ralph

Reputation: 120771

The maven configuration looks correct.

Make sure that the hoptoad-notifier-1.8.jar is correct deployed.

For an standalone app, this means for example specified in the argument list or the manifiest. For an web app, it means the jar is copied (by maven, not by you) in the libs folder.

Upvotes: 1

Related Questions