Как включить в jar test class и все зависимости? - PullRequest
0 голосов
/ 30 апреля 2020

Я использую IntelliJ для проекта со многими модулями:

  Root
    |-->Module1
    |-->Module2
    |-->Module3
    pom.xml

Каждый модуль Eache имеет pom. xml. и имеет также Test Class в src \ test \ java*.

pom моего родителя. xml это:

<groupId>it.anas.testSuite</groupId>
    <artifactId>TestSuite</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    <name>TestSuite</name>
    <properties>
        <maven.test.skip.exec>true</maven.test.skip.exec>   <---this for no run test when i do mvn install
    </properties>
    <modules>
        <module>SimulatorFrontEndTest</module>
        <module>SmartRoadApiTest</module>
        <module>SimulRestTest</module>
        <module>SmartRoadSimulatorTest</module>
    </modules>
<build>
    <pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.2.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>test-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    </pluginManagement>
</build>

с maven-jar-plugin при ido MVN PACKAGE я получаю 3 банки без тестового класса и, таким образом, зависимостей. В IntelliJ я могу создать 3 банки, включая тест в CREATE ARTIFACT и ВКЛЮЧИТЬ ТЕСТ С ЗАВИСИМОСТЬЮ (в каждом pom. xml в модуле). Я должен поставить зависимость в pom родителей. xml или в каждом модуле pom. xml? это pom module1: .... it.anas.testSuite TestSuite 0.0.1

<artifactId>SimulatorFrontEndTest</artifactId>
<packaging>jar</packaging>
<name>SimulatorFrontEndTest</name>



<dependencies>

    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>json-schema-validator</artifactId>
        <version>4.3.0</version>
    </dependency>

    <dependency>
        <groupId>org.yaml</groupId>
        <artifactId>snakeyaml</artifactId>
        <version>1.26</version>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <version>5.6.0</version>
    </dependency>

    <dependency>
        <groupId>io.rest-assured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>3.0.3</version>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.10.3</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-jdk14</artifactId>
        <version>1.7.30</version>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.12</version>
        <scope>provided</scope>
    </dependency>

    <!--dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>7.0.0</version>
    </dependency-->

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.12.0</version>
    </dependency>

    <!--<dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-surefire-provider</artifactId>
        <version>1.0.0-M4</version>
    </dependency>
    <dependency>
        <groupId>org.junit.vintage</groupId>
        <artifactId>junit-vintage-engine</artifactId>
        <version>4.12.0-M4</version>
    </dependency>-->
    <dependency>
        <groupId>org.junit.platform</groupId>
        <artifactId>junit-platform-runner</artifactId>
        <version>1.6.2</version>
        <!--<version>${junit.platform.version}</version>-->
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13</version>
        <scope>compile</scope>
    </dependency>

</dependencies>

    <build>
        <pluginManagement>
        <plugins>
            <!--plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
            </plugin-->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>

            <!--plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin-->

        </plugins>
    </pluginManagement>

    </build>

я хочу genereate:

jar1 (module1) для module1 с этими зависимостями.

jar2 (module2) с его зависимостями.

jar3 (module3) с его зависимостями.

когда я делаю пакет mvn в этой папке проекта.

Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...