在Linux上运行时,exec-maven-plugin发现Class Not Found异常

在Linux上运行时,exec-maven-plugin发现Class Not Found异常,第1张

概述我试图运行TestNG测试.我的项目组织是 – src-> test-> java-> comp> shn->库 以下命令在 Windows中运行良好,但在 Linux中失败. mvn -X clean exec:java -Dexec.mainClass="com.shn.library.RunSuitesInParallel" -Dexec.classpathScope=test -e Lin 我试图运行TestNG测试.我的项目组织是 – src-> test-> java-> comp> shn->库
以下命令在 Windows中运行良好,但在 Linux中失败.
mvn -X clean exec:java -Dexec.mainClass="com.shn.library.RunSuitesInParallel" -Dexec.classpathScope=test -e

linux在运行相同命令时发现错误 –

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project UAF: An exception occured while executing the Java class. com.shn.library.RunSuitesInParallel -> [Help 1]org.apache.maven.lifecycle.lifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project UAF: An exception occured while executing the Java class. com.shn.library.RunSuitesInParallel        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)        at org.apache.maven.lifecycle.internal.lifecycleModuleBuilder.buildProject(lifecycleModuleBuilder.java:84)        at org.apache.maven.lifecycle.internal.lifecycleModuleBuilder.buildProject(lifecycleModuleBuilder.java:59)        at org.apache.maven.lifecycle.internal.lifecycleStarter.singleThreadedBuild(lifecycleStarter.java:183)        at org.apache.maven.lifecycle.internal.lifecycleStarter.execute(lifecycleStarter.java:161)        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)        at java.lang.reflect.Method.invoke(Method.java:601)        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. com.shn.library.RunSuitesInParallel        at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:352)        at org.apache.maven.plugin.DefaultBuildpluginManager.executeMojo(DefaultBuildpluginManager.java:101)        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)        ... 19 moreCaused by: java.lang.classNotFoundException: com.shn.library.RunSuitesInParallel        at java.net.urlclassloader.run(urlclassloader.java:366)        at java.net.urlclassloader.run(urlclassloader.java:355)        at java.security.AccessController.doPrivileged(Native Method)        at java.net.urlclassloader.findClass(urlclassloader.java:354)        at java.lang.classLoader.loadClass(ClassLoader.java:423)        at java.lang.classLoader.loadClass(ClassLoader.java:356)        at org.codehaus.mojo.exec.ExecJavaMojo.run(ExecJavaMojo.java:285)        at java.lang.Thread.run(Thread.java:722)[ERROR][ERROR][ERROR] For more information about the errors and possible solutions,please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
解决方法 我跑了 –
mvn clean install.

发布时,我跑 –

mvn -X clean exec:java -Dexec.mainClass="com.shn.library.RunSuitesInParallel" -Dexec.classpathScope=test -e

编译的类被删除&错误是显而易见的.

所以解决方案是 –

mvn -X clean install exec:java -Dexec.mainClass="com.shn.library.RunSuitesInParallel" -Dexec.classpathScope=test -e
总结

以上是内存溢出为你收集整理的在Linux上运行时,exec-maven-plugin发现Class Not Found异常全部内容,希望文章能够帮你解决在Linux上运行时,exec-maven-plugin发现Class Not Found异常所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1045236.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存