maven - JaCoCo Injection Error executing maven test via ssh
问题描述
I am attempting to set up continuous integration testing for my open source project on a remote AIX server. I can execute tests just fine in an interactive shell:
$ ssh gate.polarhome.com -p 775 -l oshi
<password dialog>
<PATH set via .profile>
$ echo $PATH
> /usr/java8_64/bin:~/apache-maven-3.6.3/bin/:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
$ cd ~/git/oshi
$ mvn test -B
When executing in this interactive environment using exactly these steps, the test executes properly. However, when attempting to execute the identical commands via an SSH command line, the JaCoCo plugin fails:
$ ssh gate.polarhome.com -p 775 -l oshi "export PATH=/usr/java8_64/bin:~/apache-maven-3.6.3/bin/:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.; cd ~/git/oshi; mvn test -B"
After entering password, the commands proceed through the mvn test
but then fail with an exception:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Operating System and Hardware Information [pom]
[INFO] oshi-core [jar]
[INFO] oshi-core-shaded [jar]
[INFO] oshi-demo [jar]
[INFO] oshi-dist [pom]
[INFO]
[INFO] --------------------< com.github.oshi:oshi-parent >---------------------
[INFO] Building Operating System and Hardware Information 5.3.7-SNAPSHOT [1/5]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- git-commit-id-plugin:4.0.3:revision (git-commit-id) @ oshi-parent ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.2.0:parse-version (default) @ oshi-parent ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ oshi-parent ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:prepare-agent (pre-unit-test) @ oshi-parent ---
[WARNING] Error injecting: org.jacoco.maven.AgentMojo
java.lang.NoClassDefFoundError: org.jacoco.core.runtime.AgentOptions
at java.lang.Class.getDeclaredMethodsImpl (Native Method)
at java.lang.Class.getDeclaredMethods (Class.java:1008)
at com.google.inject.spi.InjectionPoint.getDeclaredMethods (InjectionPoint.java:766)
at com.google.inject.spi.InjectionPoint.getInjectionPoints (InjectionPoint.java:683)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields (InjectionPoint.java:378)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies (ConstructorBindingImpl.java:182)
at com.google.inject.internal.InjectorImpl.getInternalDependencies (InjectorImpl.java:661)
at com.google.inject.internal.InjectorImpl.cleanup (InjectorImpl.java:617)
at com.google.inject.internal.InjectorImpl.initializeJitBinding (InjectorImpl.java:603)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding (InjectorImpl.java:932)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive (InjectorImpl.java:852)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding (InjectorImpl.java:291)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow (InjectorImpl.java:222)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow (InjectorImpl.java:1040)
at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1071)
at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1034)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050)
at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke (Method.java:508)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
(Full log available here)
Using the -X
switch on maven, the log line immediately preceding the error is:
[DEBUG] Configuring mojo org.jacoco:jacoco-maven-plugin:0.8.6:prepare-agent from plugin realm ClassRealm[plugin>org.jacoco:jacoco
I have searched StackOverflow for similar issues. The closest I found was this question with similar symptoms, but associated with a Jenkins versioning problem.
I've tried various other attempts at solutions:
- Deleted the
.m2/repository
and let it rebuild - Added
clean
to the maven commands - Attempted to skip JaCoCo using
jacoco.skip=true
I'm pretty sure the issue has to do with the "injection" involved with JaCoCo, but can't figure out how to bypass, skip, or further investigate problems with this.
I'm at a loss for a next troubleshooting step. What is different about an interactive ssh enviornment vs. ssh
command-line that would cause different behavior from the jacoco-maven-plugin?
解决方案
It turns out that there was one setting in my interactive .profile
that was key to resolving this:
ulimit -n 8192
Seems rather than trying to copy path and other things over, just using source .profile
would have saved me a lot of troubleshooting time.
推荐阅读
- r - 如何从网页的不同超链接中提取数据
- javascript - 在 div 上添加 OnClick 事件
- firebase - 为什么我在 Firestore(App 引擎)中有这些奇怪的配额数字?
- elasticsearch - 如何从分数计算中取出(别名字段的长度)
- css - 桌面上的 2 列 移动设备上的 1 列,带有 flexbox
- python - 使用python从json格式中获取指定数据?
- android - Chrome 自定义选项卡链接不会启动应用程序,但移动版 chrome 浏览器会
- java - BeanCreationException:在将 eureka 服务器添加到 Spring Boot 应用程序时抛出名为“simpleMeterRegistry”的 bean 创建错误
- python - 如何仅将推文的文本获取到 json 文件中
- java - 为什么 ThumbnailUtils.createVideoThumbnail() 从图库中获取视频时返回 null