0

pom-файл такой:

<?xml version="1.0" encoding="UTF-8"?>
<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>1</groupId>
    <artifactId>1</artifactId>
    <version>1.0</version>
    <dependencies>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-testng-adaptor</artifactId>
            <version>LATEST</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.1</version>
        </dependency>
    </dependencies>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <testSourceDirectory>${basedir}/src/main/java/</testSourceDirectory>
                <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                    <property>
                        <name>listener</name>
                        <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
                    </property>
                </properties>
                <workingDirectory>${project.basedir}</workingDirectory>
                <argLine>-Dmaven.browser</argLine>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
            <configuration>
                <testSourceDirectory>${basedir}/src/main/java/</testSourceDirectory>
                <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
                <testFailureIgnore>false</testFailureIgnore>
                <argLine>-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                </argLine>
                <properties>
                    <property>
                        <name>listener</name>
                        <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
                    </property>
                </properties>
                <argLine>-Dmaven.browser</argLine>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjweaver</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>ru.yandex.qatools.allure</groupId>
                <artifactId>allure-maven-plugin</artifactId>
                <version>LATEST</version>
            </plugin>
        </plugins>
    </reporting>
</project>

mvn clear test site пишет следующие:

[INFO] Scanning for projects...

[ERROR] [ERROR] Some problems were encountered while processing the POMs:

[ERROR] Malformed POM C:\Users\astaninama\IdeaProjects\untitled\pom.xml: Unrecog nised tag: 'dependency' (position: START_TAG seen ...\n\n ... @10:21) @ C:\Users\astaninama\IdeaProjects\untitled\pom.xml, line 10 , column 21

[ERROR] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefi re-plugin must be a valid version but is 'LATEST'. @ line 56, column 18

[ERROR] 'reporting.plugins.plugin.artifactId' is missing. @ line 40, column 13 @

[ERROR] The build could not read 1 project -> [Help 1]

[ERROR]

[ERROR] The project 1:1:1.0 (C:\Users\astaninama\IdeaProjects\untitled\pom.xml ) has 3 errors

[ERROR] Malformed POM C:\Users\astaninama\IdeaProjects\untitled\pom.xml: Unr ecognised tag: 'dependency' (position: START_TAG seen ...\n\n < dependency>... @10:21) @ C:\Users\astaninama\IdeaProjects\untitled\pom.xml, lin e 10, column 21 -> [Help 2]

[ERROR] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-su refire-plugin must be a valid version but is 'LATEST'. @ line 56, column 18

[ERROR] 'reporting.plugins.plugin.artifactId' is missing. @ line 40, column 13

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit ch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please rea d the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildin gException

[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseExce ption

Почему не находит allure-maven-plagin и allute-testng-adaptor ?

1 ответ 1

2

Это ошибка не несуществующих пакетов, это ошибка целостности pom.xml. Если вы откуда-то копировали содержимое pom, скорее всего в него попали непечатные символы, из-за которых происходят ошибки. Попробуйте вручную переписать секцию dependencies, потому что с т.з. синтаксиса все выглядит нормально, и тег dependency, на котором все ломается - вполне легальный.

Кроме того, в pom.xml есть следующие ошибки:

  • секция plugins должна входить в секцию build
  • aspectj.version должен быть указан в секции properties

После их исправления проект успешно заводится

<?xml version="1.0" encoding="UTF-8"?>
<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>1</groupId>
    <artifactId>1</artifactId>
    <version>1.0</version>

    <properties>
      <aspectj.version>1.8.9</aspectj.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-testng-adaptor</artifactId>
            <version>LATEST</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.1</version>
        </dependency>
    </dependencies>
    <build>
      <plugins>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.7</version>
          <configuration>
          <testSourceDirectory>${basedir}/src/main/java/</testSourceDirectory>
          <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
          <properties>
              <property>
              <name>usedefaultlisteners</name>
              <value>false</value>
              </property>
              <property>
              <name>listener</name>
              <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
              </property>
          </properties>
          <workingDirectory>${project.basedir}</workingDirectory>
          <argLine>-Dmaven.browser</argLine>
          </configuration>
      </plugin>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.16</version>
          <configuration>
          <testSourceDirectory>${basedir}/src/main/java/</testSourceDirectory>
          <testClassesDirectory>${project.build.directory}/classes/</testClassesDirectory>
          <testFailureIgnore>false</testFailureIgnore>
          <argLine>-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
          </argLine>
          <properties>
              <property>
              <name>listener</name>
              <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
              </property>
          </properties>
          <argLine>-Dmaven.browser</argLine>
          </configuration>
          <dependencies>
          <dependency>
              <groupId>org.aspectj</groupId>
              <artifactId>aspectjweaver</artifactId>
              <version>${aspectj.version}</version>
          </dependency>
          </dependencies>
      </plugin>
      </plugins>
    </build>
    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>ru.yandex.qatools.allure</groupId>
                <artifactId>allure-maven-plugin</artifactId>
                <version>LATEST</version>
            </plugin>
        </plugins>
    </reporting>
</project>
13
  • попробовала, но ошибки остались :(
    – mariatest
    4 окт 2016 в 11:13
  • @mariatest я попробовал скопировать целиком ваш pom.xml, внести небольшие правки (см. обновленный ответ), и проект у меня успешно собрался
    – etki
    4 окт 2016 в 11:23
  • действительно, проект успешно собрался, правда есть несколько предупреждений. однако секция <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> подчеркнута красным
    – mariatest
    4 окт 2016 в 11:46
  • @mariatest секция properties была добавлена? что выводит при наведении?
    – etki
    4 окт 2016 в 11:46
  • properties была добавлена как в ответе выше. при наведении пишет, что такая зависимость не найдена
    – mariatest
    4 окт 2016 в 11:48

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.