Maven resolve dependencies issues - maven

I want to know what is the best aproach in a Maven conflict situation like this one
I have this library
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>3.3.3</version>
</dependency>
Which has a dependency with
netty-transport 4.15.final
And I have this other dependency
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-extras</artifactId>
<version>3.1.0</version>
</dependency>
Which contains the dependency
netty-transport 4.0.37
It´s seems like the cassandra version with the 4.15.final does not work
So normally in this cases what you have to do, if I exclude the netty
from the vertx dependency it´s most probably it wont work with the version of Cassandra, and the other way around.
Are those library with those versions condemned to do not work together?
Regards.

Related

Defining maven dependency for JBoss 5.1.0 GA

I'm migrating a legacy project to maven, right now I have some classes that depend on this org.apache.log4j.Logger class. I am sure that this class is provided by the JBoss AS 5.1.0 GA in which it is deployed. But I don't know what groupId, artifactId and version specify for this provided dependency. Do you have some idea of which ones are the correct values for this version of JBoss?
According to this post it is, 1.2.14 version. You can add like below.
https://developer.jboss.org/thread/242961
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<scope>provided</scope>
</dependency>

Is there a link between org.wildfly.bom and the version of the wildfly server used?

I'm currently developing some applications and I'm using wildfly 9.0.2.Final as the application server. Currently I'm using bom version 8.2.2.Final for the following artifacts:
jboss-javaee-7.0-with-tools
jboss-javaee-7.0-with-hibernate
jboss-javaee-7.0-with-security
I've started using these versions while following a tutorial. However I've seen that now wildfly 10 is out and probably some other dependencies also have dependencies. Maybe in the future javaee-8.0 will be available.
Is there some documentation on what the different artifacts include and maybe what should be kept in mind when upgrading the parent bom version?
With WildFly 9+ boms we changed structure a bit, so now we only have 2 boms.
Where most of them were merged into one.
wildfly-javaee7
wildfly-javaee7-with-tools
Where second one includes not only APIs but also tools that are useful for testing like arquillian, junit, etc...
so best for your needs would be to use this in your pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-javaee7-with-tools</artifactId>
<scope>import</scope>
<type>pom</type>
<version>10.0.0.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
you can always find latest info and docs on how to use it at github at repository https://github.com/wildfly/boms
Your BOM version should match your deployment Wildfly version.
Assuming you use provided scope for dependencies that are provided by Wildfly, you want to ensure you're using the correct versions. If you use a wrong version, your application might not work as expected or even fail to start, because some API might be deprecated/removed, or because some features might not be available yet.
Side note: Wildfly BOMs lack some dependencies, so we're using parent as BOM:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-parent</artifactId>
<version>9.0.2.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

How to get the source code for the javax:javaee-api-6.0.jar

I use the javax:javaee-api-6.0.jar maven artifact.
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
I would like to download its source code with the dependency:sources mvn goal.
I was looking for the sources in the official maven repositories, but I still can't find it.
Could you give me a bit of advice on how can I achieve my object?
Thank you.
Mich is correct.
The purpose of the javaee-api module is to satisfy compile-time dependencies (That is why the Maven scope is set to provided). The module contains interface declarations (or contract) which must be satisfied by the J2EE container you plan to use.
If you really need/want to see the source code, I'd suggest taking a look at one of the open source J2EE containers.
see if these are any good and if they work for you http://repo1.maven.org/maven2/org/apache/openejb/javaee-api/
Try this: (it has sources attached)
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>3.0.3.Final</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
It pulls in a huge number of dependencies, but as they are all provided you do effectively not alter your artifact.

Cannot find SerialAddress class in Apache Mina 2.0.2

I added the below dependencies in my project POM file and the SerialAddress class is no where to be found from the downloaded mina-core.2.0.2.jar.
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
<version>2.0.2</version>
</dependency>
the package org.apache.mina.transport.serial doesnt even exist. Please advice me on the correct Dependency.
It looks like this class is not part of mina-core. Some exploration lead to the existence of Apache Mina Serial Communication Support.
So I guess you would want to add the dependency for mina-transport-serial.
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-transport-serial</artifactId>
<version>2.0.2</version>
</dependency>

Cannot migrate from spring 2.5 to spring 3.0

Problem is a bit stupid but I can't find any spring3.0-with-dependencies.jar. Is it assumed that I should find all necessary dependencies by myself?
May I use dependencies from spring 2.5 in this case? UPD: answer is no, I can't. So, where are the dependencies??
I guess they don't release them any more. You can have the dependencies automatically if you use maven or ivy. All you need is to define the dependencies in your pom.xml like this:
<pom>
...
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
</dependencies>
...
</pom>
Maven will bring all the dependencies transitively.
If you are using Maven, you can get Spring 3.0 jars (and their transitive dependencies) from the central repository. Simply add this to your pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
For more details, more artifacts, check out Obtaining Spring 3 Artifacts with Maven (and please, don't use EBR if you don't need it or I guarantee the nightmare).
Usually the readme.txt file has the dependencies listed for each module. With that you can usually get them easiest from the maven repository... or better yet, with maven (http://maven.apache.org).

Resources