简体   繁体   中英

No java classes in downloaded Selenium jar

I am trying to upgrade to Selenum 4.0.0-alpha-6 (same issue happens also with version 3.141.59) which seems to be available in Maven repository . I tried first to add this dependency to my pom.xml:

<dependency>            
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>4.0.0-alpha-6</version>
</dependency>

The version appears red in IntelliJ which for some reason sees 3.12.0 as the last available version. I know what version IntelliJ sees because I can hit CTRL-space inside the <version> tag.

Running mvn install also complains that the version is not available. So my first question is why do Intellij and Maven not see the latest versions of Selenium?

I reverted to downloading the jar file directly from mvnrepository (that is from here ) and adding it to my local repository as follows:

mvn install:install-file -Dfile=selenium-java-4.0.0-alpha-6.jar 
-DgroupId=org.seleniumhq.selenium -DartifactId=selenium-java 
-Dversion=4.0.0-alpha-6 -Dpackaging=jar -DgeneratePom=true

The jar appears now in my local repo, the Maven dependency does not appear red anymore, but all Selenium-related references in my project appear red. Examining the downloaded jar file reveals that it contains no Java classes:

C:\Development\Java\Selenium>jar tf selenium-java-4.0.0-alpha-6.jar
META-INF/
META-INF/MANIFEST.MF
META-INF/versions/9/
META-INF/versions/9/module-info.class

Any idea what I am missing?

Update: I have added a small project in GitHub that demonstrates the problem. The pom just has the Selenium dependency. Just running mvn install results in the error below. So this is not just a problem with IntelliJ:

[ERROR] Failed to execute goal on project MySeleniumProject: Could not resolve dependencies for project com.my:MySeleniumProject:jar:1.0-SNAPSHOT: Failed to collect dependencies for [org.seleniumhq.selenium:selenium-java:jar:3.141.59 (compile)]: Failed to read artifact descriptor for org.seleniumhq.selenium:selenium-ja
va:jar:3.141.59: Could not transfer artifact org.seleniumhq.selenium:selenium-java:pom:3.141.59 from/to central (http://repo.maven.apache.org/maven2): Failed to
 transfer file: http://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-java/3.141.59/selenium-java-3.141.59.pom. Return code is: 501 , ReasonPhras
e:HTTPS Required.

Try use stable older version

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
</dependency>

Check also, if you have other errors in pom, and have proper java version

I think your project is correct and problem is with maven configuration. Use commandline to see what maven version you have? maven -v. Try use mvn dependency:resolve on the project - from command line

The problem is resolved by upgrading maven. I had Maven 3.0.5, and uprading to 3.6.3 resolved the dependency successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM