Maven正在跳过测试

时间:2019-05-14 18:14:32

标签: maven unit-testing testing sonarqube pom.xml

默认情况下,Maven为何跳过所有测试?我的pom.xml文件中的配置文件很少,因此我无法运行测试

mvn -X干净测试-pl。,模块名称-Dmaven.test.skip = false

输出:

reuseForks = false
runOrder = alphabetical
reportsDirectory = 

BuildDir/RTCJNK/workspace/167363/Monthly_Release_E21_Sonar_Test/citirisk- 
common/target/surefire-reports
reuseForks = false
runOrder = alphabetical
skip = false
skipExec = true
skipTests = false
testClassesDirectory = 
BuildDir/RTCJNK/workspace/167363/Monthly_Release_E21_Sonar_Test/citirisk- 
common/target/test-classes
testFailureIgnore = false
testNGArtifactName = org.testng:testng
testSourceDirectory = 
BuildDir/RTCJNK/workspace/167363/Monthly_Release_E21_Sonar_Test/citirisk- 
common/src/test/java
trimStackTrace = true
useFile = true
useManifestOnlyJar = true
useSystemClassLoader = true
useUnlimitedThreads = false
workingDirectory = 
BuildDir/RTCJNK/workspace/167363/Monthly_Release_E21_Sonar_Test/citirisk- 
common
project = MavenProject: com.citi.167363:citirisk-common:1.0.0-SNAPSHOT @ 
BuildDir/RTCJNK/workspace/167363/Monthly_Release_E21_Sonar_Test/citirisk- 
common/pom.xml
session = org.apache.maven.execution.MavenSession@44e4cf8a
Build:: [DEBUG] -- end configuration --
Build:: [INFO] Tests are skipped.

POM(配置文件之一)

<id>ccbsonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>

            <sonar.host.url>http://vm-efc5-d6ec.nam.nsroot.net:9000/</sonar.host.url>
            <sonar.login>xxx</sonar.login>
            <sonar.password>xxx</sonar.password>
            <sonar.java.source>1.8</sonar.java.source>
            <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
            <jacoco.version>0.7.4.201502262128</jacoco.version>
            <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
            <jacoco.outputDir>${project.basedir}/target/</jacoco.outputDir>
            <sonar.projectName>Java</sonar.projectName> 
            <sonar.jacoco.reportPaths>${project.basedir}/target/jacoco.exec</sonar.jacoco.reportPaths>
            <sonar.junit.reportPaths>${project.basedir}/target/</sonar.junit.reportPaths>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.13</version>
                    <configuration>
                        <argLine>-Xms1024m -Xmx3072m -XX:MaxPermSize=1024m  -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC ${jacoco.agent.ut.arg}</argLine>
                        <!-- Specific to generate mapping between tests and covered code -->
                        <properties>
                        <!--    <property>
                                <name>listener</name>
                                <value>org.sonar.java.jacoco.JUnitListener</value>
                            </property> -->
                        </properties>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                    <executions>
                        <!-- Prepares a variable, jacoco.agent.ut.arg, that contains the info
                            to be passed to the JVM hosting the code being tested. -->
                        <execution>
                            <id>prepare-ut-agent</id>
                            <phase>process-test-classes</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <destFile>${sonar.jacoco.reportPaths}</destFile>
                                <propertyName>jacoco.agent.ut.arg</propertyName>
                                <append>true</append>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.codehaus.sonar-plugins.java</groupId>
                <artifactId>sonar-jacoco-listeners</artifactId>
                <version>${sonar-jacoco-listeners.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

我包括pom的配置文件之一,我也以类似的方式配置了模块的子pom。

0 个答案:

没有答案