How to add dependency to commons-lang

1,726 views
Skip to first unread message

mathias

unread,
Nov 28, 2014, 4:57:05 PM11/28/14
to ve...@googlegroups.com
My verticle implementation should make use of the class HashCodeBuilder from the apache lib commons-lang.

But the problem is that "clean compile vertx:runMod" results in a compile failure.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project mymodule-vertx: Compilation failure: Compilation failure:
[ERROR] /.../TestVerticle.java:[25,39] package org.apache.commons.lang.builder does not exist
[ERROR] /.../TestVerticle.java:[63,17] cannot find symbol
[ERROR] symbol:   class HashCodeBuilder



So I added the dendency to the pom.xml (super pom):


</dependencies>
...
<dependency>

     
<groupId>commons-lang</groupId>
       
<artifactId>commons-lang</artifactId>
     
<version>2.4</version>
     
<scope>compile</scope>
     
</dependency>
</dependencies>

This compiles fine. But this way I get a NoClassDefFoundError at runtime:
SEVERE: Exception in Java verticle
java.lang.NoClassDefFoundError: org/apache/commons/lang/builder/HashCodeBuilder

How to do it the right way?

Alexander Lehmann

unread,
Nov 28, 2014, 6:15:13 PM11/28/14
to ve...@googlegroups.com
how are you running your program in the end?

mathias

unread,
Nov 29, 2014, 5:00:51 AM11/29/14
to ve...@googlegroups.com
I use the following command: "mvn clean compile vertx:runMod"
Message has been deleted

Jez P

unread,
Nov 29, 2014, 5:26:30 AM11/29/14
to ve...@googlegroups.com
You need to run dependency:copy-dependencies after clean

Alexander Lehmann

unread,
Nov 29, 2014, 7:26:31 AM11/29/14
to ve...@googlegroups.com
I usually use "mvn clean package vertx:runMod" to run the module inside maven.

mathias

unread,
Nov 29, 2014, 9:31:53 AM11/29/14
to ve...@googlegroups.com
Everything runs fine with "mvn clean package vertx:runMod".
Thank you both!
Reply all
Reply to author
Forward
0 new messages