2016-05-09 10 views
0

Ich habe Elternprojekt - Selen und Kind Projekt als Projekt 1, meine Absicht ist, alle wiederverwendbaren Klassen in Eltern und Test in Kind haben.Wenn ich versuche, den Test von Kind Projekt ich habe Der unten angegebene Fehler konnte mir helfen. "Fehler beim Ausführen des Ziels für Projekt 1: Abhängigkeiten für Projekt konnten nicht aufgelöst werden. com.aero:project1:pom: 1.0-SNAPSHOT: Die folgenden Artefakte konnten nicht aufgelöst werden: com.automation : parentproject: jar: 1.0-SNAPSHOT ". Ich habe versucht, mvn clean und mvn am übergeordneten Projekt zuerst und Kind Projekt dann ausgeführt mvn todsichere: test, aber habe die oben genannte Ausnahme.
Hinweis: Als ich das übergeordnete Projekt bauen doesnot es die .jar-Datei im PfadMaven Parent - Kind Projekt Ausgabe

.M2 erzeugt

pom.xml -------

<?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>com.automation</groupId> 
    <artifactId>parentproject</artifactId> 
    <packaging>pom</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
    <modules> 
     <module>project1</module> 
    </modules> 
    <dependencies> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.53.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-htmlunit-driver</artifactId> 
      <version>2.52.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.9.10</version> 
     </dependency> 
      <dependency> 
      <groupId>org.springframework</groupId> 
      <artifactId>spring-jdbc</artifactId> 
      <version>3.2.1.RELEASE</version> 
     </dependency> 
    </dependencies> 
</project> 

Kinder 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"> 
    <parent> 
     <artifactId>selenium</artifactId> 

     <groupId>com.automation</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> <modelVersion>4.0.0</modelVersion> 

    <artifactId>project1</artifactId> 
    <packaging>pom</packaging> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.19.1</version> 
       <configuration> 
        <suiteXmlFiles> 
         <suiteXmlFile>testng.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>com.automation</groupId> 
      <artifactId>parentproject</artifactId> 
      <version>1.0-SNAPSHOT</version> 
     </dependency> 
    </dependencies> 


</project> 
+0

über dem pom.xml Erwähnt – user3350712

Antwort

0

1- Sie Kind Pom, das auf das falsche Elternartefakt verweist.

2- direkte Abhängigkeit zu "parentproject" sollte entfernt werden, da seine Eltern und keine Abhängigkeit.

Parent:

<?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>com.automation</groupId> 
<artifactId>parentproject</artifactId> 
<packaging>pom</packaging> 
<version>1.0-SNAPSHOT</version> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
<modules> 
    <module>project1</module> 
</modules> 
<dependencies> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.53.0</version> 
    </dependency> 
    <dependency><--!You are not using the Java bindings (i.e. Python, C#, or Ruby) and would like to use HtmlUnit Driver--> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-htmlunit-driver</artifactId> 
     <version>2.52.0</version> 
    </dependency> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.9.10</version> 
     <scope>test</scope> 
    </dependency> 
     <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-jdbc</artifactId> 
     <version>3.2.1.RELEASE</version> 
    </dependency> 
</dependencies> 

Kind:

<?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"> 
<parent> 
    <artifactId>parentproject</artifactId> 

    <groupId>com.automation</groupId> 
    <version>1.0-SNAPSHOT</version> 
</parent> <modelVersion>4.0.0</modelVersion> 

<artifactId>project1</artifactId> 
<packaging>pom</packaging> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.19.1</version> 
      <configuration> 
       <suiteXmlFiles> 
        <suiteXmlFile>testng.xml</suiteXmlFile> 
       </suiteXmlFiles> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 
<dependencies> 
    <dependency> 
     ... 
    </dependency> 
</dependencies> 

hoffe, das hilft

+0

Test ist bereits im Child-Projekt erwähnt und immer noch das gleiche Problem – user3350712

+0

können Sie Ihre Frage mit dem Kind Pom aktualisieren? –

+0

Ja, ich habe aktualisiert Kind Pom, können Sie bitte einen Blick – user3350712