jeudi 30 avril 2020

How include in jar test class and all dependency?

i use IntelliJ for a project with many modules:

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

Eache Module has a pom.xml. and has also Test Class in src\test\java*.

My parent's pom.xml is this:

<groupId>it.anas.testSuite</groupId>
    <artifactId>TestSuite</artifactId>
    <version>0.0.1</version>
    <packaging>pom</packaging>
    <name>TestSuite</name>
    <properties>
        <maven.test.skip>true</maven.test.skip>   <---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>

with maven-jar-plugin when ido MVN PACKAGE i obtain 3 jar without test class and so dependencies.. In intelliJ i'm able to create 3 jar include test in CREATE ARTIFACT and INCLUDE TEST WITH DEPENDENCY (in each pom.xml in module). I must put dependency in parent's pom.xml or in each module pom.xml?

Aucun commentaire:

Enregistrer un commentaire