0

I have a good understanding of Maven basics, but few things are unclear to me. Please help me with the following:

  1. I understand that a transitive dependency isn't declared in your POM. So, where can you see a transitive dependency?

  2. What does it mean to resolve a dependency? How can you do it manually?

  3. I have heard of things like InteliJ and GitHub. Are those obligatory, if you have Maven?

  4. Does it ever happen in the real world that an application is developed in Java, but Selenium testing is done in Selenium with Python, Ruby or C#? I would assume that in this case CI would be problematic, but there are still places out there that don't use CI

1 Answer 1

2

1: A transitive dependency is a dependency of a dependency you've included in your Maven project. You can print a tree of dependencies for any Maven project by executing the following.

mvn dependency:tree

This will print a tree with all the dependencies of your project, showing the dependency of each of the dependencies and, in turn, also their dependencies. Below is an exerpt from the dependency tree of a project that depends on org.seleniumhq.selenium:selenium-server. Every node in the tree below the first dependency is a transitive dependency for your project.

[INFO] +- org.seleniumhq.selenium:selenium-server:jar:2.45.0:compile
[INFO] |  +- org.bouncycastle:bcprov-jdk15on:jar:1.48:compile
[INFO] |  +- org.bouncycastle:bcpkix-jdk15on:jar:1.48:compile
[INFO] |  +- mx4j:mx4j-tools:jar:3.0.1:compile
[INFO] |  +- org.mortbay.jetty:servlet-api-2.5:jar:6.1.9:compile
[INFO] |  +- org.seleniumhq.selenium:jetty-repacked:jar:7.6.1:compile
[INFO] |  +- org.seleniumhq.selenium:jetty-rc-repacked:jar:5:compile
[INFO] |  +- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] |  +- org.seleniumhq.selenium:selenium-java:jar:2.45.0:compile
[INFO] |  |  +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.45.0:compile
[INFO] |  |  |  \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.45.0:compile
[INFO] |  |  |     +- cglib:cglib-nodep:jar:2.1_3:compile
[INFO] |  |  |     +- com.google.code.gson:gson:jar:2.3.1:compile
[INFO] |  |  |     +- org.seleniumhq.selenium:selenium-api:jar:2.45.0:compile
[INFO] |  |  |     \- com.google.guava:guava:jar:18.0:compile

To read more about transitive dependencies the Maven manual is a good starting point. Or read more about the dependency tree plugin.

2: Maven resolves the dependencies of your project by downloading them from a Maven repository, which can be either a local repository (your development machine, usually in the ~/.m2/ folder) or a remote repository. Sometimes, you may have to add the dependencies to your repository manually. Depending on the presence of the pom file in the META-INF directory of your JAR-file this command should be enough.

mvn install:install-file -Dfile=<path-to-file>

3: IntelliJ is an IDE, GitHub is a Git repository hosting service and Maven is a build automation tool. Typically, a developer will write code in IntelliJ, push it to GitHub for version control and use Maven to build his project locally or/and on a CI server such as Jenkins. So each of these are very different tools, with different goals. None of them are required by Maven to be part of your workflow.

4: This question is very context dependent, but in general it seems to be preferable to use the same language for both the test code and production code. This is a nice answer to this question that elaborates a bit more. Ofcourse, there will always be situations where it is impossible or infeasible due to time constraints, skill or other circumstances to use the same language for both.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.