On 10/03/2015 01:45, Deven Phillips wrote:
I can't say that I am familiar with the usage of the "dependencyManagement"
element in Maven POM files... Could you recommend a good reference? The
maven reference for this section only talks about it's use in multi-module
projects, so I'm not sure what you are explaining here.
Explaining powerful tools is almost always complex. Maven is no exception. :-)

"Dependency Management" is useful to resolve version conflicts in your dependencies.

Let's say you have an artefact A having dependencies on artefacts B and C.
B and C have dependencies on artefact D v1 and D v2

The graph would look like :

A -> B -> D v1
  |-> C -> D v2

When you build your project, typically your war, maven can not guess by itself which version it should pick. AFAIK, it picks the first requested in the dependency tree, based on dependency order.

As you are a great programmer, you know all of the libraries and frameworks you are using. So, you perfectly know D, and you know that the best option there would be to use v2

So, on A's pom.xml, you would add a dependency management section ordering that to maven.

In your cas, you would typically add
<dependencyManagement>
    <dependencies>
            <dependency>
                <groupId>org.javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.18.1-GA</version>
            </dependency>
    </dependencies>
</dependencyManagement>

To your pom.xml, as a subelement of <project>

Hope this helps.

"Dependency Management" will make your hands dirty (forcing a version is opening a door to many problems, as you will forget it one day when you upgrade the dependencies), but it is just required sometimes in real world.

Of course, it is not always enough. If you have dependencies on two incompatible versions of a package, this will not help.

To get a more complete explanation, I advise to read https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

Hope this helps,

Ludovic


Thanks in advance!

Deven

On Mon, Mar 9, 2015 at 6:08 AM, [email protected] <[email protected]> wrote:

On 09/03/2015 08:55, Christian Kaltepoth wrote:

AFAIK both Hibernate and Weld require Jandex in different versions. Make
sure you are using an up to date version of Janex. I had similar problems
in the past and adding a <dependencyManagment> section for Jandex fixed
the
problem for me.

I took a look and noticed that :
* there is not jandex version conflict in the dependency tree

$ mvn dependency:tree -Dverbose=true


  [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------
------------
[INFO] Building restlet-deltaspike-demo 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------
------------
[WARNING] The POM for org.restlet.jse:org.restlet.ext.guice:jar:2.3.1 is
missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @
restlet-deltaspike-demo ---
[WARNING] Missing POM for org.restlet.jse:org.restlet.ext.guice:jar:2.3.1
[INFO] com.zanclus:restlet-deltaspike-demo:jar:1.0-SNAPSHOT
[INFO] +- org.apache.deltaspike.core:deltaspike-core-api:jar:1.2.1:
compile
[INFO] +- org.apache.deltaspike.modules:deltaspike-servlet-module-api:
jar:1.2.1:compile
[INFO] |  \- (org.apache.deltaspike.core:deltaspike-core-api:jar:1.2.1:compile
- omitted for duplicate)
[INFO] +- org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api:jar:1.
2.1:compile
[INFO] +- org.apache.deltaspike.modules:deltaspike-jpa-module-api:jar:
1.2.1:compile
[INFO] |  \- (org.apache.deltaspike.core:deltaspike-core-api:jar:1.2.1:compile
- omitted for duplicate)
[INFO] +- org.restlet.jse:org.restlet:jar:2.3.1:compile
[INFO] +- org.restlet.jse:org.restlet.ext.jaxrs:jar:2.3.1:compile
[INFO] |  +- commons-fileupload:commons-fileupload:jar:1.3:compile
[INFO] |  |  \- commons-io:commons-io:jar:2.2:compile
[INFO] |  +- javax.mail:mail:jar:1.4.2:compile
[INFO] |  |  \- javax.activation:activation:jar:1.1:compile
[INFO] |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.12:compile
[INFO] |  |  \- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] |  |     +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |     \- (javax.activation:activation:jar:1.1:compile -
omitted for duplicate)
[INFO] |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] |  +- org.restlet.jse:org.restlet.lib.org.json:jar:2.0:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.6:compile
[INFO] |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] |  \- (org.restlet.jse:org.restlet:jar:2.3.1:compile - omitted
for duplicate)
[INFO] +- org.restlet.jse:org.restlet.ext.guice:jar:2.3.1:compile
[INFO] +- org.reflections:reflections:jar:0.9.9-RC1:compile
[INFO] |  +- com.google.guava:guava:jar:11.0.2:compile
[INFO] |  |  \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  +- org.javassist:javassist:jar:3.16.1-GA:compile
[INFO] |  \- dom4j:dom4j:jar:1.6.1:compile
[INFO] |     \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.10:compile
[INFO] +- org.jboss.weld.se:weld-se:jar:2.2.9.Final:compile
[INFO] +- com.h2database:h2:jar:1.3.175:compile
[INFO] +- org.projectlombok:lombok:jar:1.14.8:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-
api:jar:1.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.1.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.
Beta1:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:4.3.1.Final:compile
[INFO] |  |  +- (org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile -
omitted for duplicate)
[INFO] |  |  +- 
(org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
- omitted for duplicate)
[INFO] |  |  +- (org.jboss.spec.javax.transaction:jboss-transaction-
api_1.2_spec:jar:1.0.0.Final:compile - omitted for duplicate)
[INFO] |  |  +- (dom4j:dom4j:jar:1.6.1:compile - omitted for duplicate)
[INFO] |  |  +- 
(org.hibernate.common:hibernate-commons-annotations:jar:4.0.4.Final:compile
- omitted for duplicate)
[INFO] |  |  +- 
(org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
- omitted for duplicate)
[INFO] |  |  +- (org.javassist:javassist:jar:3.18.1-GA:compile - omitted
for conflict with 3.16.1-GA)
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] |  +- (dom4j:dom4j:jar:1.6.1:compile - omitted for duplicate)
[INFO] |  +- org.hibernate.common:hibernate-commons-annotations:
jar:4.0.4.Final:compile
[INFO] |  |  +- (org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile -
omitted for duplicate)
[INFO] |  |  \- 
(org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
- omitted for duplicate)
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-
api:jar:1.0.0.Final:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-
api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  \- (org.javassist:javassist:jar:3.18.1-GA:compile - omitted
for conflict with 3.16.1-GA)
[INFO] +- org.restlet.jse:org.restlet.ext.jetty:jar:2.3.1:runtime
[INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.2.6.v20141205:runtime
[INFO] |  |  \- (org.eclipse.jetty:jetty-util:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty:jetty-io:jar:9.2.6.v20141205:runtime
[INFO] |  |  \- (org.eclipse.jetty:jetty-util:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty:jetty-server:jar:9.2.6.v20141205:runtime
[INFO] |  |  +- (javax.servlet:javax.servlet-api:jar:3.1.0:runtime -
omitted for duplicate)
[INFO] |  |  +- (org.eclipse.jetty:jetty-http:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  \- (org.eclipse.jetty:jetty-io:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty:jetty-client:jar:9.2.6.v20141205:runtime
[INFO] |  |  +- (org.eclipse.jetty:jetty-http:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  \- (org.eclipse.jetty:jetty-io:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.2.6.v20141205:runtime
[INFO] |  +- org.eclipse.jetty.spdy:spdy-client:jar:9.2.6.v20141205:
runtime
[INFO] |  |  +- (org.eclipse.jetty.spdy:spdy-core:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  \- org.eclipse.jetty:jetty-alpn-client:jar:9.2.6.v20141205:
runtime
[INFO] |  |     \- (org.eclipse.jetty:jetty-io:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty.spdy:spdy-core:jar:9.2.6.v20141205:runtime
[INFO] |  |  +- (org.eclipse.jetty:jetty-util:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  \- (org.eclipse.jetty:jetty-io:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty.spdy:spdy-http-common:jar:9.2.6.
v20141205:runtime
[INFO] |  |  \- (org.eclipse.jetty.spdy:spdy-core:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty.spdy:spdy-http-server:jar:9.2.6.
v20141205:runtime
[INFO] |  |  +- 
(org.eclipse.jetty.spdy:spdy-http-common:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  +- (org.eclipse.jetty.spdy:spdy-server:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  \- (org.eclipse.jetty:jetty-client:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- org.eclipse.jetty.spdy:spdy-server:jar:9.2.6.v20141205:
runtime
[INFO] |  |  +- (org.eclipse.jetty.spdy:spdy-core:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  +- (org.eclipse.jetty.spdy:spdy-client:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  |  \- (org.eclipse.jetty:jetty-server:jar:9.2.6.v20141205:runtime
- omitted for duplicate)
[INFO] |  +- (javax.servlet:javax.servlet-api:jar:3.1.0:runtime -
omitted for duplicate)
[INFO] |  \- (org.restlet.jse:org.restlet:jar:2.3.1:runtime - omitted
for duplicate)
[INFO] +- org.apache.deltaspike.cdictrl:deltaspike-cdictrl-weld:jar:1.
2.1:runtime
[INFO] |  \- 
(org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api:jar:1.2.1:runtime
- omitted for duplicate)
[INFO] +- org.apache.deltaspike.modules:deltaspike-servlet-module-
impl:jar:1.2.1:runtime
[INFO] |  +- (org.apache.deltaspike.core:deltaspike-core-api:jar:1.2.1:runtime
- omitted for duplicate)
[INFO] |  +- org.apache.deltaspike.core:deltaspike-core-impl:jar:1.2.
1:runtime
[INFO] |  |  \- (org.apache.deltaspike.core:
deltaspike-core-api:jar:1.2.1:runtime - omitted for duplicate)
[INFO] |  \- 
(org.apache.deltaspike.modules:deltaspike-servlet-module-api:jar:1.2.1:runtime
- omitted for duplicate)
[INFO] +- org.apache.deltaspike.modules:deltaspike-jpa-module-impl:
jar:1.2.1:runtime
[INFO] |  +- (org.apache.deltaspike.core:deltaspike-core-api:jar:1.2.1:runtime
- omitted for duplicate)
[INFO] |  +- (org.apache.deltaspike.core:deltaspike-core-impl:jar:1.2.1:runtime
- omitted for duplicate)
[INFO] |  \- 
(org.apache.deltaspike.modules:deltaspike-jpa-module-api:jar:1.2.1:runtime
- omitted for duplicate)
[INFO] +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:runtime
[INFO] |  +- (org.slf4j:slf4j-api:jar:1.7.7:runtime - omitted for
conflict with 1.7.10)
[INFO] |  \- org.apache.logging.log4j:log4j-api:jar:2.1:runtime
[INFO] +- junit:junit:jar:4.12:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] \- org.apache.deltaspike.modules:deltaspike-test-control-
module-api:jar:1.2.1:test
[INFO]    \- (org.apache.deltaspike.core:deltaspike-core-api:jar:1.2.1:test
- omitted for duplicate)

However, there is a version conflict with javassist that I strongly advise
to handle using dependencyManagement, or you will get hard to understand
"bugs". :-)

It seems to me that you do not have a version conflict, but rather that
the jandex jar (and I guess many others) is not in the classpath when your
test is run.

Hope this helps...

Ludovic
|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|



|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|

Reply via email to