0

我完全像记录的那样,但在编译 MAVEN Build 时仍然出错。

共享 MAVEN 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>myMavenTest</groupId>
  <artifactId>com.myTest</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>com.myTest</name>
  <url>http://maven.apache.org</url>

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <aspectj.version>1.7.4</aspectj.version>
    <allure.version>1.4.1</allure.version>
  </properties>


   <dependencies>
    <dependency>
     <groupId>org.testng</groupId>
     <artifactId>testng</artifactId>
     <version>6.1.1</version>
     <scope>test</scope>
    </dependency>
   <!-- Selenium -->
      <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.28.0</version>
      </dependency>
   <!-- POI -->


<dependency>
    <groupId>org.apache.xmlbeans</groupId>
    <artifactId>xmlbeans</artifactId>
    <version>2.3.0</version>
</dependency>
<!--  Log4J  -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.14</version>
</dependency>
<!-- JavaMail  -->
<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4</version>
</dependency>


    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-testng-adaptor</artifactId>
        <version>${allure.version}</version>
    </dependency>


  </dependencies>

  <build>
        <plugins>




            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.17</version>
            <configuration>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>
                    -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                </argLine>
                <!--only for 1.3.* TestNG adapters. Since 1.4.0.RC4 listener adds via ServiceLoader-->
                <properties>
                    <property>
                        <name>listener</name>
                        <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
                    </property>
                </properties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
         </plugins>
    </build>
 <reporting>
    <plugins>


        <plugin>
                <groupId>ru.yandex.qatools.allure</groupId>
                <artifactId>allure-maven-plugin</artifactId>
                <version>2.0</version>
            </plugin>



    </plugins>
  </reporting>







</project>

这是文档中给出的

可以为任何 TestNG 测试生成 Allure 报告。为了获得测试结果,您需要:

将 AllureTestListener 添加到 TestNG 设置 添加 AspectJ Weaver 依赖项及其属性 运行测试

这就是我得到的

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-source-plugin:2.2.
1:jar (attach-sources) on project com.myTest: Execution attach-sources of goal o
rg.apache.maven.plugins:maven-source-plugin:2.2.1:jar failed: Plugin org.apache.
maven.plugins:maven-source-plugin:2.2.1 or one of its dependencies could not be
resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-sourc
e-plugin:jar:2.2.1 -> org.codehaus.plexus:plexus-archiver:jar:2.2: Failed to rea
d artifact descriptor for org.codehaus.plexus:plexus-archiver:jar:2.2: Could not
 transfer artifact org.codehaus.plexus:plexus-archiver:pom:2.2 from/to central (
https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.
maven.apache.org -> [Help 1]
4

1 回答 1

0

尝试将以下内容添加到您的 pom.xml 中:

  <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-java-commons</artifactId>
        <version>2.6.0</version>
    </dependency>

    <dependency>
        <groupId>ru.yandex.qatools.allure</groupId>
        <artifactId>allure-testng-adaptor</artifactId>
        <version>1.5.4</version>
    </dependency>
于 2018-04-17T11:52:22.577 回答