微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在现有的 pom.xml 中添加 maven 编译器和 surefire 插件

如何解决无法在现有的 pom.xml 中添加 maven 编译器和 surefire 插件

作为 maven 新手,我想在 pom.xml 中添加以下插件依赖,有人可以帮我吗

  • 需要添加这个

    org.apache.maven.plugins Maven 编译器插件 2.3.2. 1.7 1.7 org.apache.maven.plugins maven-surefire-plugin 2.12 真的 测试文件
  • 退出 Pom.xml

    4.0.0 www.asr.com 阿斯尔 0.0.1-快照

     <dependencies>
         <dependency>
             <groupId>org.seleniumhq.selenium</groupId>
             <artifactId>selenium-java</artifactId>
             <version>3.141.59</version>
         </dependency>
    
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <version>7.3.0</version>
             <scope>compile</scope>
         </dependency>
     </dependencies>
    

解决方法

你必须在标签内添加你的插件。

例如:

  <build>
    <plugins>    
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>${asm.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <version>${asm.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <useFile>false</useFile>
          <excludes>
            <exclude>**/integration/**</exclude>
          </excludes>
          <includes>
            <include>**/*Test.java</include>
            <include>**/*Spec.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。