MAVEN : Run Multiple Maven Project using Maven Test -


i have 3 maven projects. project1, project2 & project3. project3 depends on project1 & project2 , project2 depends on project1.

for have added in project2 pom.xml file

<modelversion>4.0.0</modelversion>    <groupid>project2</groupid>   <artifactid>project2</artifactid>   <version>0.0.1-snapshot</version>    <dependencies>      <dependency>             <groupid>project1</groupid>             <artifactid>project1</artifactid>             <version>0.0.1-snapshot</version>     </dependency>   </dependencies> 

my pom.xml project3 -

<modelversion>4.0.0</modelversion>   <groupid>project3</groupid>   <artifactid>project3</artifactid>   <version>0.0.1-snapshot</version>    <dependencies>         <dependency>             <groupid>project1</groupid>             <artifactid>project1</artifactid>             <version>0.0.1-snapshot</version>          </dependency>           <dependency>             <groupid>project2</groupid>             <artifactid>project2</artifactid>             <version>0.0.1-snapshot</version>         </dependency>   </dependencies> 

in project 3 have added testng.xml file run test. if run testng.xml file test cases running successfully. if tried run test cases using maven test failing.

i have included testng.xml file in pom file below dependencies run testng test using maven -

<build>         <!-- source directory configuration -->         <sourcedirectory>src</sourcedirectory>         <plugins>             <!-- following plugin executes testng tests -->             <plugin>                 <groupid>org.apache.maven.plugins</groupid>                 <artifactid>maven-surefire-plugin</artifactid>                 <version>2.14.1</version>                 <configuration>                     <!-- suite testng xml file consider test execution -->                     <suitexmlfiles>                         <suitexmlfile>tng1.xml</suitexmlfile>                     </suitexmlfiles>                 </configuration>             </plugin>             <!-- compiler plugin configures java version used compiling code -->             <plugin>                 <artifactid>maven-compiler-plugin</artifactid>                 <configuration>                     <source>1.6</source>                     <target>1.6</target>                 </configuration>             </plugin>         </plugins>     </build> 

it showing error message -

the pom project1:project1:jar:0.0.1-snapshot missing, no dependency information available. pom project2:project2:jar:0.0.1-snapshot missing, no dependency information available

failed execute goal on project project3: not resolve dependencies project project3:project3:jar:0.0.1-snapshot: following artifacts not resolved: project1:project1:jar:0.0.1-snapshot, project2:project2:jar:0.0.1-snapshot: not find artifact project1:project1:jar:0.0.1-snapshot -> [help 1

please !!!

you have install project1 , project2 in maven repository first.

to launch command

mvn clean install 

in project1 , project2 directory (start project1 because project2 has dependecy project1)

edit:

for jenking, create root pom module declaration. maven order module dependencies.

in root pom have

<modules>     <module>project1</module>     <module>project2</module>     <module>project3</module>   </modules> 

and in submodule

  <parent>   <groupid>com.mygroupid</groupid>   <artifactid>project-root</artifactid>   <version>1.0-snapshot</version>   </parent> 

yon can check http://books.sonatype.com/mvnex-book/reference/multimodule.html full example


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -