转载

java – 声纳测试用例失败

我正在尝试为我的一个项目获得声纳报告.

我已经运行了mvn clean install

Running blah.blah.BlahTest1
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running blah.blah.BlahTest2
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.078 sec

当我运行mvn声纳:声纳我得到了轰鸣声错误.

[INFO] ------------------------------------------------------------------------
[INFO] Building Component name
[INFO]    task-segment: [org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test]
[INFO] ------------------------------------------------------------------------
[INFO] [surefire:test {execution: default-cli}]
[INFO] Surefire report directory: D:/CodeBase/Project/module/target/surefire-reports
java.lang.NoClassDefFoundError: null
Caused by: java.lang.ClassNotFoundException: null
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: null.  Program will exit.
Exception in thread "main" 
[ERROR] There are test failures.

我不知道从哪里开始.我尝试在谷歌搜索找不到任何类似于我的问题.

请帮助我理解哪些可能是寻找的原因.

谢谢.

添加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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <!--============================================================= -->
    <!--The Basics  -->
    <!--============================================================= -->
    <groupId>###</groupId>
    <artifactId>###</artifactId>
    <packaging>pom</packaging>
    <version>###</version>
    <url>###</url>
    <!--============================================================= -->
    <!--Project Information -->
    <!--============================================================= -->

    <!--============================================================= -->
    <!--Properties -->
    <!--============================================================= -->
    <properties>
        <!--general properties -->
        <svn-base-url>###</svn-base-url>

        <!--versions of 3rd party libraries -->

        <!--plug in versions -->
        <version.jacoco.plugin>0.7.4.201502262128</version.jacoco.plugin>
    </properties>
    <scm>

    </scm>
    <!--============================================================= -->
    <!--Modules -->
    <!--============================================================= -->
    <modules>
    </modules>
    <!--============================================================= -->
    <!--Distribution Management -->
    <!--============================================================= -->
    <distributionManagement>
    </distributionManagement>

    <!--============================================================= -->
    <!--Plugin Repository -->
    <!--============================================================= -->
    <pluginRepositories>
    </pluginRepositories>
    <!--============================================================= -->
    <!--Dependency Management -->
    <!--============================================================= -->
    <dependencyManagement>
    <!--3rd part libraries -->
    </dependencyManagement>
    <!--============================================================= -->
    <!--Dependencies -->
    <!--============================================================= -->
    <dependencies>
    </dependencies>
    <!--============================================================= -->
    <!--Build Information -->
    <!--============================================================= -->
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>**/*</exclude>
                </excludes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${version.clean.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${version.compiler.plugin}</version>
                    <configuration>
                        <source>1.6</source>
                        <target>1.6</target>
                        <fork>true</fork>
                        <meminitial>128m</meminitial>
                        <maxmem>512m</maxmem>
                        <compilerArgument>-Xlint:-serial -Xmaxwarns 9999 -Xmaxerrs 9999</compilerArgument>
                    </configuration>
                </plugin>
                <plugin>
                  <groupId>org.jacoco</groupId> 
                  <artifactId>jacoco-maven-plugin</artifactId> 
                  <version>${version.jacoco.plugin}</version> 
                  <configuration>
                    <append>true</append> 
                    <destFile>target/coverage-reports/jacoco-unit.exec</destFile> 
                    <dataFile>target/coverage-reports/jacoco-unit.exec</dataFile> 
                    <includes>
                      <include>path</include> 
                    </includes>
                  </configuration>
                  <executions>
                    <execution>
                      <id>prepare-agent</id> 
                      <goals>
                        <goal>prepare-agent</goal> 
                      </goals>
                    </execution>
                    <execution>
                      <id>report</id> 
                      <phase>prepare-package</phase> 
                      <goals>
                        <goal>report</goal> 
                      </goals>
                    </execution>
                  </executions>
                </plugin>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <version>${version.surefire.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${version.enforcer.plugin}</version>
                    <configuration>
                        <rules>
                            <requireJavaVersion>
                                <version>1.6</version>
                            </requireJavaVersion>
                            <requireMavenVersion>
                                <version>2.2.0</version>
                            </requireMavenVersion>
                        </rules>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${version.versions.plugin}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${version.assembly.plugin}</version>
                    <configuration>
                        <descriptors>
                           <!-- descriptors -->
                        </descriptors>
                    </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-release-plugin</artifactId>
                    <version>${version.release.plugin}</version>
                    <configuration>
                        <goals>deploy</goals>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${version.resources.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${version.install.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${version.site.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <version>${version.jxr.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>cobertura-maven-plugin</artifactId>
                    <version>${version.cobertura.plugin}</version>
                    <configuration>
                        <formats>
                            <format>xml</format>
                        </formats>
                        <instrumentation>
                            <!--Include and exclude -->
                        </instrumentation>
                        <maxmem>512M</maxmem>
                    </configuration>
                    <executions>
                        <execution>
                            <id>clean</id>
                            <phase>pre-site</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>instrument</id>
                            <phase>package</phase>
                            <goals>
                                <goal>cobertura</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>${version.pmd.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>${version.findbugs.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${version.checkstyle.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>dashboard-maven-plugin</artifactId>
                    <version>${version.dashboard.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${version.buildhelper.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <version>${version.jaxb2.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>taglist-maven-plugin</artifactId>
                    <version>${version.taglist.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-changelog-plugin</artifactId>
                    <version>${version.changelog.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-scm-plugin</artifactId>
                    <version>1.2</version>
                    <configuration>
                        <connectionType>developerConnection</connectionType>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${version.jar.plugin}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${version.exec-maven.plugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${version.antrun.plugin}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>remove-project-artifact</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>remove-project-artifact</goal>
                        </goals>
                        <configuration>
                            <removeAll>false</removeAll>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId> 
                <artifactId>jacoco-maven-plugin</artifactId> 
            </plugin>
              <!--  Need the argLine in the configuration here otherwise jacoco hook into surefire correctly for unit test coverage -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                  <forkMode>once</forkMode>
                  <argLine>${argLine} -XX:MaxPermSize=256M -Xmx892M -client</argLine>
                </configuration>
            </plugin>   
        </plugins>
    </build>    
</project>
原文  https://codeday.me/bug/20190110/500765.html
正文到此结束
Loading...