我有一个LeanFT
项目,当我从 IDE 执行它时,它工作正常。我用 .jar 生成了一个 jar 文件maven-assembly-plugin
。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>test.LeanFTest</mainClass>
</manifest>
</archive>
<finalName>${project.artifactId}-fatjar-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/leanft-assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
当我尝试通过 TestExportTool 执行它(为 ALM 导入生成 XML 文件)时,我收到各种错误消息,例如:
log4j: WARN JmDNS or serviceInfo not found
java.lang.UnsatisfiedLinkError: 没有 NTEventLogAppender
java.lang.NoClassDefFoundError
我导入了所有必要的类,解决了这些问题,但TestExportTool
一次又一次出现异常。我添加了这些依赖项,由错误消息报告,但项目不使用这些依赖项,所以不确定它为什么要求。
<dependency>
<groupId>org.jmdns</groupId>
<artifactId>jmdns</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.dblock.log4jna</groupId>
<artifactId>log4jna-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
leaft-assembly.xml 文件:
<id>fat-tests</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>test</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.directory}/test-classes</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.class</include>
</includes>
<useDefaultExcludes>true</useDefaultExcludes>
</fileSet>
</fileSets>
最新错误消息的详细堆栈跟踪:
Hewlett-Packard Enterprise LeanFT 测试导出工具。[main] 调试 javax.jmdns.impl.JmDNSImpl - JmDNS 实例创建于 2018-07-06 11:17:21,741 线程“main”java.lang.NoClassDefFoundErr 或:org/apache/tools/ant/taskdefs/LogOutputStream 中的异常java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java. net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java .net.URLClassLoader。
更新 07.09。:我添加了 TestExportTool 要求的所有依赖项。我从 Hewlett-Packard Enterprise LeanFT 测试导出工具收到以下消息:
[main] DEBUG javax.jmdns.impl.JmDNSImpl - JmDNS 实例创建于 2018-07-09 13:25:17,419 bshpath.BshClassLoader