【问题标题】:Trying to create a batch file for maven project尝试为 Maven 项目创建批处理文件
【发布时间】:2020-10-24 03:33:48
【问题描述】:

当我在 pom.xml 中执行 maven clean 和 maven install 时,我构建成功并且我的所有测试用例都运行良好。然后在记事本中我写如下 d: cd D:我的项目的路径 mvn 干净安装

并用 .bat 扩展名保存它。但是当我双击批处理文件时它不运行。请帮助。非常感谢提前。

这是我的 pom.xml 文件

    <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>xyz</groupId>
      <artifactId>Abc</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      
      <properties>
    <suiteXmlFile>src/main/resources/Able/TestRunner/ProjectExecution.xml</suiteXmlFile>
    </properties>
      
      <dependencies>
      <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
      </dependency>
      
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>4.0.9</version>
    </dependency>
    
      <!-- https://mvnrepository.com/artifact/org.testng/testng-->
      <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.11</version>
      </dependency>
         <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>4.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.12</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-excelant -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-excelant</artifactId>
        <version>3.17</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-examples -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-examples</artifactId>
        <version>3.17</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>3.17</version>
    </dependency>
        
        <dependency>`enter code here`
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        
        <!-- https://mvnrepository.com/artifact/commons-io/commons-io-->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.5</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
    </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.apache.james/apache-mime4j -->
    <dependency>
        <groupId>org.apache.james</groupId>
        <artifactId>apache-mime4j</artifactId>
        <version>0.6</version>
    </dependency>
        
        <!-- https://mvnrepository.com/artifact/dom4j/dom4j -->
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.1</version>
    </dependency>
        <!-- https://mvnrepository.com/artifact/com.beust/jcommander -->
    <dependency>
        <groupId>com.beust</groupId>
        <artifactId>jcommander</artifactId>
        <version>1.29</version>
    </dependency>
        
        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.17</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.17</version>
    </dependency>
    
    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.17</version>
    </dependency>
      
      </dependencies>
      
       <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>
     <plugin>
     <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.19.1</version>
      <configuration>
      <suiteXmlFiles>
      <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
      </suiteXmlFiles>
      </configuration>
      </plugin>
     </plugins>
     
     </build>
      
      
    </project>

when i start the batch file this happens(a picture of error

【问题讨论】:

  • 请添加bat 文件并描述启动它时会发生什么。
  • @JFMeier 我编辑了错误的帖子

标签: eclipse selenium maven


【解决方案1】:

所以你机器上的 Java 是 JRE,而不是 JDK。

安装 JDK 并将其放在您的 PATH 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-28
    • 1970-01-01
    • 2021-10-16
    • 2011-01-29
    • 1970-01-01
    • 2012-05-14
    • 1970-01-01
    • 2013-08-31
    相关资源
    最近更新 更多