1

I have created a maven project through Eclipse and added all dependency's and plugins to pom.xml file. Now, I have created a package as "com.Qedge" under "src/test/java" folder then,created a class under com.Qedge package with a piece of code written using JAVA. when I right click on project to run as "maven Test", Eclipse not showing the option in run. I could able to see the same option when i right click on pom.xml file of the project.

I am new to Maven, I would like to know is there any specific reason for this behavior? What am I supposed to do to get the same option from Project folder (I.e Right click on project - Run as - Maven Test).

Please find my pom.xml file below.

    <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.Qedge</groupId>
  <artifactId>MavenProjectDemo</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>MavenProjectDemo</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
       <dependency>             
            <groupId>org.seleniumhq.selenium</groupId>                              
            <artifactId>selenium-java</artifactId>                              
            <version>2.53.1</version>                               
        </dependency>               
        <dependency>                
            <groupId>org.testng</groupId>                               
            <artifactId>testng</artifactId>                             
            <version>6.11</version>                             
            <scope>test</scope>                                     
       </dependency>
       <dependency>             
            <groupId>org.apache.poi</groupId>                               
            <artifactId>poi-ooxml</artifactId>                              
            <version>3.16</version>                             
            <scope>test</scope>                                     
       </dependency>
    </dependencies>

<build>  
    <pluginManagement> 
        <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.6.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
            <inherited>true</inherited>
                <configuration>
                     <suiteXmlFiles>
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                     </suiteXmlFiles>
                </configuration>
        </plugin>
        </plugins>
    </pluginManagement>
</build>
</project>
Sri
  • 31
  • 1
  • 3
  • 5

2 Answers2

0

Do a right click on your project Mark as Deployable. After it would be ok.

enter image description here

rbcvl
  • 406
  • 3
  • 13
0

Right click project, Configure -> Convert to Maven Project.

Abdullah Nurum
  • 305
  • 2
  • 9