When trying to convert selenium project to maven project .. is showing me byte buddy.jar error

Viewed 930

Archive for required library: 'C:/Users/TOPS/.m2/repository/net/bytebuddy/byte-buddy/1.7.5/byte-buddy-1.7.5.jar' in project 'Maven1' cannot be read or is not a valid ZIP file

this is the error which is shown in Problem window in eclipse

Steps I have done to convert seleniumn project

  1. Create a simple selenium webdriver project

  2. convert it to maven project

  3. remove all the selenium jar from the library options

  4. In pom.xml add all the dependencies

  5. Add the JRE and Maven from Add library options

Then it is showing me this error.

My pom.xml file is this if there is anything missing then plz tell me

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>Maven1</groupId>
  <artifactId>Maven1</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
     <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
         <configuration>
           <source>1.8</source>
           <target>1.8</target>
       </configuration>
       </plugin>
    </plugins>
 </build>

 <dependencies>
          <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-server</artifactId>
                <version>3.0.1</version>
          </dependency>

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

         <dependency>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
              <version>4.12</version>
            </dependency>
          <dependency>
          <groupId>org.apache.maven.surefire</groupId>
          <artifactId>surefire-booter</artifactId>
          <version>2.20.1</version>
      </dependency>
   </dependencies>
 </project>
1 Answers

About Byte Buddy

Byte Buddy is a Java library for creating Java classes at run time. This artifact is a build of Byte Buddy with a remaining dependency onto ASM. You should never depend on this module without repackaging Byte Buddy and ASM into your own namespace.

As you are seeing an error as Archive for required library: 'C:/Users/TOPS/.m2/repository/net/bytebuddy/byte-buddy/1.7.5/byte-buddy-1.7.5.jar' in project 'Maven1' cannot be read or is not a valid ZIP file I will suggest the following steps :

  • Remove all the dependencies and do maven clean and maven install
  • Add the required Selenium dependency only
  • Either add selenium-server or selenium-java as a dependency as per your exact requirement.
  • Use only the latest Selenium dependencies from Maven Artifact current one being <version>3.7.1</version>
  • Use only compatible junit dependencies
  • I can see you have used the surefire-booter dependency as follows (cross check if you need it):

      <dependency>
        <groupId>org.apache.maven.surefire</groupId>
        <artifactId>surefire-booter</artifactId>
        <version>2.20.1</version>
      </dependency>
    
  • Finally, the maven-surefire-plugin is clearly missing. You need to add the following plugin :

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
            <suiteXmlFiles>
                <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
            </suiteXmlFiles>
        </configuration>
    </plugin>
    
Related