J
J
JuliyKhimiy2017-09-21 14:41:25
Java
JuliyKhimiy, 2017-09-21 14:41:25

How to create an executable using maven java project in Intellij idea and of course selenium and testng?

.jar file I create maven projects-> lifecycle-> install by double click.
In connection with the use of different options described in the internet, I received different errors.
How to make links correctly (or it can be done differently) and get an executable file as a result,
after it has worked, get a report with test results, and also set test execution priorities.
Many different options are described, but somehow none of them worked. Help me figure out what I missed and how to do it right,
judging by how many similar questions I have met without an answer, this is quite relevant.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zakharov Alexander, 2017-09-21
@AlexZaharow

You should use package, not install: install is executed after the package is built. Install puts the file in the local repository.

J
JuliyKhimiy, 2017-09-22
@JuliyKhimiy

Thank you. But the problem was not solved.
Project structure.
In the folder "main" I have a page factory, and in the folder "test" the tests themselves
My 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>11</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.11</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.4.0</version>
        </dependency>
    </dependencies>
</project>

The tests themselves run (without a build) and build, but the jar does not run
"C:\Program Files (x86)\Java\jdk1.8.0_121\bin\java" -Dfile.encoding=windows-1251 -jar "D:\Autotests\ page factory\target\11-1.0-SNAPSHOT.jar"
no main manifest attribute, in D:\Autotests\page factory\target\11-1.0-SNAPSHOT.jar Process
finished with exit code
already described options (in the internet) received different errors.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question