1
votes

I read around about this problem on SO, but a don't find the right answer, which is be good for me. So, I wrote mvn project and a structure in the project is something like this:

+src/test/java (package with tests classes)

+src/main/java (packages with some helper classes)

I define all environment var:

M2_HOME=C:\Program Files\apache-maven-3.5.0 ,

MAVEN_HOME=C:\Program Files\apache-maven-3.5.0 ,

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111.

cmd results :

java -version

java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

mvn -v

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00) Maven home: C:\Program Files\apache-maven-3.5.0\bin.. Java version: 1.8.0_111, vendor: Oracle Corporation Java home: c:\Program Files\Java\jdk1.8.0_111\jre Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

javac -version

javac 1.8.0_111

POM.XML

    <repositories>
        <repository>
            <id>atlassian.com</id>
            <name>Atlassian</name>
            <url>http://maven.atlassian.com/public</url>
            <layout>default</layout>
        </repository>
<!--        <repository> -->
<!--            <id>maven2-repository.dev.java.net</id> -->
<!--            <name>Java.net Repository for Maven</name> -->
<!--            <url>http://download.java.net/maven/2/</url> -->
<!--            <layout>default</layout> -->
<!--        </repository> -->
    </repositories>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <cucumber.version>1.2.2</cucumber.version>
        <selenium.version>3.0.1</selenium.version>
        <junit.version>4.12</junit.version>
        <atr.version>1.2.3</atr.version>
        <rest.version>2.4.0</rest.version>
        <jira.version>1000.824.2</jira.version>
        <jira.data.version>1000.824.2</jira.data.version>
        <amps.version>5.0.4</amps.version>
        <plugin.testrunner.version>1.2.0</plugin.testrunner.version>
        <testkit.version>6.0.51</testkit.version>
    </properties>


    <build>
<!--        <testSourceDirectory>src/test/java</testSourceDirectory> -->
            <plugins> 
<!--            <plugin> -->
<!--                <artifactId>maven-assembly-plugin</artifactId> -->
<!--                <version>2.2.1</version> -->
<!--                <configuration> -->
<!--                    <descriptorRefs> -->
<!--                        <descriptorRef>jar-with-dependencies</descriptorRef> -->
<!--                    </descriptorRefs> -->
<!--                    <archive> -->
<!--                        <manifest> -->
<!--                            <mainClass>gov.grantsolutions.pmo.App</mainClass> -->
<!--                        </manifest> -->
<!--                    </archive> -->
<!--                </configuration> -->
<!--                <executions> -->
<!--                    <execution> -->
<!--                        <id>make-assembly</id> -->
<!--                        <phase>package</phase> -->
<!--                        <goals> -->
<!--                            <goal>single</goal> -->
<!--                        </goals> -->
<!--                    </execution> -->
<!--                </executions> -->
<!--            </plugin> -->
<!--            <plugin> -->
<!--                <groupId>org.apache.maven.plugins</groupId> -->
<!--                <artifactId>maven-surefire-plugin</artifactId> -->
<!--                <version>2.20</version> -->
<!--                <configuration> -->
<!--                    <suiteXmlFiles> -->
<!--                        <suiteXmlFile>test_logging.xml</suiteXmlFile> -->
<!--                    </suiteXmlFiles> -->
<!--                </configuration> -->
<!--            </plugin> -->
<!--        <plugin> -->
<!--             <groupId>org.apache.maven.plugins</groupId> -->
<!--             <artifactId>maven-resources-plugin</artifactId> -->
<!--             <version>2.6</version> -->
<!--             <executions> -->
<!--                 <execution> -->
<!--                     <phase>test</phase> -->
<!--                     <goals> -->
<!--                         <goal>resources</goal> -->
<!--                         <goal>testResources</goal> -->
<!--                     </goals> -->
<!--                 </execution> -->
<!--             </executions> -->
<!--         </plugin> -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <dependencies>
        <!-- https://mvnrepository.com/artifact/ojdbc/ojdbc -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.3.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/junit-addons/junit-addons -->
        <dependency>
            <groupId>junit-addons</groupId>
            <artifactId>junit-addons</artifactId>
            <version>1.4</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testng/testng -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.9.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <version>1.30</version>
        </dependency>
        <dependency>
            <groupId>org.bluestemsoftware.open.maven.tparty</groupId>
            <artifactId>jettison</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>2.25</version>
        </dependency>
<!--        <dependency> -->
<!--            <groupId>com.sun.xml.bind</groupId> -->
<!--            <artifactId>jaxb-impl</artifactId> -->
<!--            <version>2.1.12</version> -->
<!--        </dependency> -->
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>1.1.1</version>
        </dependency>
<!--        <dependency> -->
<!--            <groupId>javax.xml</groupId> -->
<!--            <artifactId>jaxb-api</artifactId> -->
<!--            <version>2.1</version> -->
<!--        </dependency> -->
        <dependency>
            <groupId>javax.xml.stream</groupId>
            <artifactId>stax-api</artifactId>
            <version>1.0-2</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>stax</groupId>
            <artifactId>stax-api</artifactId>
            <version>1.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-vfs2</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.54</version>
        </dependency>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>3.3</version>
        </dependency>
        <dependency>
            <groupId>jcifs</groupId>
            <artifactId>jcifs</artifactId>
            <version>1.3.17</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
            <version>1.5</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.7</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20090211</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.6</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/net.lightbody.bmp/browsermob-core-littleproxy -->
        <!-- <dependency> <groupId>net.lightbody.bmp</groupId> <artifactId>browsermob-core-littleproxy</artifactId> 
            <version>2.1.0-beta-6</version> </dependency> -->

    </dependencies>

ERROR:

$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ATS_Test_Cases 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ATS_Test_Cases ---
[INFO] Deleting C:\git\Selenium\Selenium.git\AcceptanceTestSuite\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ATS_Test_Cases ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\git\Selenium\Selenium.git\AcceptanceTestSuite\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ ATS_Test_Cases ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 35 source files to C:\git\Selenium\Selenium.git\AcceptanceTestSuite\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/utils/Common.java:[27,35] package com.mozzartbet.qa.testCases does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/POClasses/BasePage.java:[10,18] package org.testng does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LoginDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DashboardDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LottoDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/SportTicketDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DepositDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LoginDataProvider.java:[31,2] cannot find symbol
  symbol:   class DataProvider
  location: class com.mozzartbet.qa.data.LoginDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DashboardDataProvider.java:[20,2] cannot find symbol
  symbol:   class DataProvider
  location: class com.mozzartbet.qa.data.DashboardDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LottoDataProvider.java:[32,2] cannot find symbol
  symbol:   class DataProvider
  location: class com.mozzartbet.qa.data.LottoDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/SportTicketDataProvider.java:[30,2] cannot find symbol
  symbol:   class DataProvider
  location: class com.mozzartbet.qa.data.SportTicketDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/SportTicketDataProvider.java:[49,2] cannot find symbol
  symbol:   class DataProvider
  location: class com.mozzartbet.qa.data.SportTicketDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DepositDataProvider.java:[23,2] cannot find symbol
  symbol:   class DataProvider
  location: class com.mozzartbet.qa.data.DepositDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/utils/Common.java:[36,30] cannot find symbol
  symbol:   variable Test_Preconditions
  location: class com.mozzartbet.qa.utils.Common
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/POClasses/BasePage.java:[52,17] cannot find symbol
  symbol:   variable Assert
  location: class com.mozzartbet.qa.POClasses.BasePage
[INFO] 15 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.989 s
[INFO] Finished at: 2017-07-09T18:21:16+02:00
[INFO] Final Memory: 21M/193M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project ATS_Test_Cases: Compilation failure: Compilation failure:
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/utils/Common.java:[27,35] package com.mozzartbet.qa.testCases does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/POClasses/BasePage.java:[10,18] package org.testng does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LoginDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DashboardDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LottoDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/SportTicketDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DepositDataProvider.java:[5,30] package org.testng.annotations does not exist
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LoginDataProvider.java:[31,2] cannot find symbol
[ERROR]   symbol:   class DataProvider
[ERROR]   location: class com.mozzartbet.qa.data.LoginDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DashboardDataProvider.java:[20,2] cannot find symbol
[ERROR]   symbol:   class DataProvider
[ERROR]   location: class com.mozzartbet.qa.data.DashboardDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/LottoDataProvider.java:[32,2] cannot find symbol
[ERROR]   symbol:   class DataProvider
[ERROR]   location: class com.mozzartbet.qa.data.LottoDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/SportTicketDataProvider.java:[30,2] cannot find symbol
[ERROR]   symbol:   class DataProvider
[ERROR]   location: class com.mozzartbet.qa.data.SportTicketDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/SportTicketDataProvider.java:[49,2] cannot find symbol
[ERROR]   symbol:   class DataProvider
[ERROR]   location: class com.mozzartbet.qa.data.SportTicketDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/data/DepositDataProvider.java:[23,2] cannot find symbol
[ERROR]   symbol:   class DataProvider
[ERROR]   location: class com.mozzartbet.qa.data.DepositDataProvider
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/utils/Common.java:[36,30] cannot find symbol
[ERROR]   symbol:   variable Test_Preconditions
[ERROR]   location: class com.mozzartbet.qa.utils.Common
[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/POClasses/BasePage.java:[52,17] cannot find symbol
[ERROR]   symbol:   variable Assert
[ERROR]   location: class com.mozzartbet.qa.POClasses.BasePage
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
1

1 Answers

0
votes

The problem was resolved. This piece of trace, hide the key of the answer:

[ERROR] /C:/git/Selenium/Selenium.git/AcceptanceTestSuite/src/main/java/com/mozzartbet/qa/utils/Common.java:[27,35] package com.mozzartbet.qa.testCases does not exist

In a Common class I instance object of test class?!? Why I do that? I don't know. Anyways, everything its ok with version of Java, Java compiler(compiler settings), dependecies. So I encapsulate Common class and now its not dependecy with test case class, and wverything work fine. :)