|
| 1 | +# Maven |
| 2 | + |
| 3 | +Maven downloads dependency of [the latest version](https://cwiki.apache.org/confluence/display/MAVENOLD/Dependency+Mediation+and+Conflict+Resolution#DependencyMediationandConflictResolution-DependencyVersionRanges) |
| 4 | +matching the declared range by default, in other words whenever new versions of Selenium 4 libraries are published |
| 5 | +they are pulled transitively as Appium Java Client dependencies at the first project (re)build automatically. |
| 6 | + |
| 7 | +In order to pin Selenium dependencies they should be declared in `pom.xml` in the following way: |
| 8 | + |
| 9 | +```xml |
| 10 | +<dependencies> |
| 11 | + <dependency> |
| 12 | + <groupId>io.appium</groupId> |
| 13 | + <artifactId>java-client</artifactId> |
| 14 | + <version>X.Y.Z</version> |
| 15 | + <exclusions> |
| 16 | + <exclusion> |
| 17 | + <groupId>org.seleniumhq.selenium</groupId> |
| 18 | + <artifactId>selenium-api</artifactId> |
| 19 | + </exclusion> |
| 20 | + <exclusion> |
| 21 | + <groupId>org.seleniumhq.selenium</groupId> |
| 22 | + <artifactId>selenium-remote-driver</artifactId> |
| 23 | + </exclusion> |
| 24 | + <exclusion> |
| 25 | + <groupId>org.seleniumhq.selenium</groupId> |
| 26 | + <artifactId>selenium-support</artifactId> |
| 27 | + </exclusion> |
| 28 | + </exclusions> |
| 29 | + </dependency> |
| 30 | + <dependency> |
| 31 | + <groupId>org.seleniumhq.selenium</groupId> |
| 32 | + <artifactId>selenium-api</artifactId> |
| 33 | + <version>A.B.C</version> |
| 34 | + </dependency> |
| 35 | + <dependency> |
| 36 | + <groupId>org.seleniumhq.selenium</groupId> |
| 37 | + <artifactId>selenium-remote-driver</artifactId> |
| 38 | + <version>A.B.C</version> |
| 39 | + </dependency> |
| 40 | + <dependency> |
| 41 | + <groupId>org.seleniumhq.selenium</groupId> |
| 42 | + <artifactId>selenium-support</artifactId> |
| 43 | + <version>A.B.C</version> |
| 44 | + </dependency> |
| 45 | +</dependencies> |
| 46 | +``` |
| 47 | + |
| 48 | +# Gradle |
| 49 | + |
| 50 | +Gradle uses [Module Metadata](https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html) |
| 51 | +to perform improved dependency resolution whenever it is available. Gradle Module Metadata for Appium Java Client is |
| 52 | +published automatically with every release and is available on Maven Central. |
| 53 | + |
| 54 | +Appium Java Client declares [preferred](https://docs.gradle.org/current/userguide/rich_versions.html#rich-version-constraints) |
| 55 | +Selenium dependencies version which is equal to the lowest boundary in the version range, i.e. the lowest compatible |
| 56 | +Selenium dependencies are pulled by Gradle by default. It's strictly recommended to do not use versions lower than the |
| 57 | +range boundary, because unresolvable compilation and runtime errors may occur. |
| 58 | + |
| 59 | +In order to use newer Selenium dependencies they should be explicitly added to Gradle build script (`build.gradle`): |
| 60 | + |
| 61 | +```gradle |
| 62 | +dependencies { |
| 63 | + implementation('io.appium:java-client:X.Y.Z') |
| 64 | + implementation('org.seleniumhq.selenium:selenium-api:A.B.C') |
| 65 | + implementation('org.seleniumhq.selenium:selenium-remote-driver:A.B.C') |
| 66 | + implementation('org.seleniumhq.selenium:selenium-support:A.B.C') |
| 67 | +} |
| 68 | +``` |
0 commit comments