我正在尝试发送一封电子邮件,其中包含 surfire-report 作为附件。我按照文档描述进行了 Surefire-mail 的配置,但出现以下错误:
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.ExceptionInInitializerError
at ch.fortysix.maven.plugin.postaman.surfire.SurefireMailMojo.<init>(Unknown Source)
while locating ch.fortysix.maven.plugin.postaman.surfire.SurefireMailMojo
1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1097)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1131)
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:1094)
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 jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:578)
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)
Caused by: java.lang.ExceptionInInitializerError
at org.codehaus.groovy.runtime.InvokerHelper.<clinit> (InvokerHelper.java:48)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean (DefaultTypeTransformation.java:156)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox (DefaultTypeTransformation.java:65)
at org.codehaus.gmaven.mojo.GroovyMojo.<init> (GroovyMojo.groovy)
at ch.fortysix.maven.plugin.postaman.AbstractSenderMojo.<init> (AbstractSenderMojo.groovy)
at ch.fortysix.maven.plugin.postaman.surfire.SurefireMailMojo.<init> (SurefireMailMojo.groovy)
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance (DirectConstructorHandleAccessor.java:67)
at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:500)
at java.lang.reflect.Constructor.newInstance (Constructor.java:484)
at com.google.inject.internal.DefaultConstructionProxyFactory$ReflectiveProxy.newInstance (DefaultConstructionProxyFactory.java:126)
at com.google.inject.internal.ConstructorInjector.provision (ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.access$000 (ConstructorInjector.java:32)
at com.google.inject.internal.ConstructorInjector$1.call (ConstructorInjector.java:98)
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.ConstructorInjector.construct (ConstructorInjector.java:93)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get (ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1094)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1131)
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:1094)
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 jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:578)
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)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.lang.Object.finalize() throws java.lang.Throwable accessible: module java.base does not "opens java.lang" to unnamed module @2d55b65e
at java.lang.reflect.AccessibleObject.throwInaccessibleObjectException (AccessibleObject.java:387)
at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:363)
at java.lang.reflect.AccessibleObject.checkCanSetAccessible (AccessibleObject.java:311)
at java.lang.reflect.Method.checkCanSetAccessible (Method.java:201)
at java.lang.reflect.AccessibleObject.setAccessible (AccessibleObject.java:130)
at org.codehaus.groovy.reflection.CachedClass$3$1.run (CachedClass.java:85)
at java.security.AccessController.doPrivileged (AccessController.java:318)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:80)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:78)
at org.codehaus.groovy.util.LazyReference.getLocked (LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get (LazyReference.java:20)
at org.codehaus.groovy.reflection.CachedClass.getMethods (CachedClass.java:249)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:115)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:78)
at org.codehaus.groovy.util.LazyReference.getLocked (LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get (LazyReference.java:20)
at org.codehaus.groovy.reflection.CachedClass.getMethods (CachedClass.java:249)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:115)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:78)
at org.codehaus.groovy.util.LazyReference.getLocked (LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get (LazyReference.java:20)
at org.codehaus.groovy.reflection.CachedClass.getMethods (CachedClass.java:249)
at org.codehaus.groovy.reflection.stdclasses.CachedClosureClass.<init> (CachedClosureClass.java:14)
at org.codehaus.groovy.reflection.ClassInfo.createCachedClass (ClassInfo.java:247)
at org.codehaus.groovy.reflection.ClassInfo.access$400 (ClassInfo.java:35)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue (ClassInfo.java:413)
at org.codehaus.groovy.reflection.ClassInfo$LazyCachedClassRef.initValue (ClassInfo.java:404)
at org.codehaus.groovy.util.LazyReference.getLocked (LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get (LazyReference.java:20)
at org.codehaus.groovy.reflection.ClassInfo.getCachedClass (ClassInfo.java:88)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass (ReflectionCache.java:107)
at org.codehaus.groovy.reflection.ParameterTypes.getParametersTypes0 (ParameterTypes.java:77)
at org.codehaus.groovy.reflection.ParameterTypes.getParameterTypes (ParameterTypes.java:63)
at org.codehaus.groovy.reflection.CachedMethod.compareToCachedMethod (CachedMethod.java:148)
at org.codehaus.groovy.reflection.CachedMethod.compareTo (CachedMethod.java:131)
at java.util.ComparableTimSort.binarySort (ComparableTimSort.java:262)
at java.util.ComparableTimSort.sort (ComparableTimSort.java:207)
at java.util.Arrays.sort (Arrays.java:1041)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:111)
at org.codehaus.groovy.reflection.CachedClass$3.initValue (CachedClass.java:78)
at org.codehaus.groovy.util.LazyReference.getLocked (LazyReference.java:33)
at org.codehaus.groovy.util.LazyReference.get (LazyReference.java:20)
at org.codehaus.groovy.reflection.CachedClass.getMethods (CachedClass.java:249)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods (MetaClassRegistryImpl.java:132)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init> (MetaClassRegistryImpl.java:83)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init> (MetaClassRegistryImpl.java:61)
at groovy.lang.GroovySystem.<clinit> (GroovySystem.java:28)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit> (InvokerHelper.java:48)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean (DefaultTypeTransformation.java:156)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox (DefaultTypeTransformation.java:65)
at org.codehaus.gmaven.mojo.GroovyMojo.<init> (GroovyMojo.groovy)
at ch.fortysix.maven.plugin.postaman.AbstractSenderMojo.<init> (AbstractSenderMojo.groovy)
at ch.fortysix.maven.plugin.postaman.surfire.SurefireMailMojo.<init> (SurefireMailMojo.groovy)
at jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance (DirectConstructorHandleAccessor.java:67)
at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:500)
at java.lang.reflect.Constructor.newInstance (Constructor.java:484)
at com.google.inject.internal.DefaultConstructionProxyFactory$ReflectiveProxy.newInstance (DefaultConstructionProxyFactory.java:126)
at com.google.inject.internal.ConstructorInjector.provision (ConstructorInjector.java:114)
at com.google.inject.internal.ConstructorInjector.access$000 (ConstructorInjector.java:32)
at com.google.inject.internal.ConstructorInjector$1.call (ConstructorInjector.java:98)
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.ConstructorInjector.construct (ConstructorInjector.java:93)
at com.google.inject.internal.ConstructorBindingImpl$Factory.get (ConstructorBindingImpl.java:306)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1094)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1131)
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:1094)
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 jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:578)
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)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2023-10-23T15:25:24+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal ch.fortysix:maven-postman-plugin:0.1.6:surefire-mail (send surefire notification) on project inspector-clouseau: Execution send surefire notification of goal ch.fortysix:maven-postman-plugin:0.1.6:surefire-mail failed: Unable to load the mojo 'surefire-mail' in the plugin 'ch.fortysix:maven-postman-plugin:0.1.6' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>ch.fortysix:maven-postman-plugin:0.1.6
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
我的 pom.xml 看起来像:
<dependencies>
<dependency>
<groupId>io.quarkiverse.cucumber</groupId>
<artifactId>quarkus-cucumber</artifactId>
<version>${quarkus-cucumber.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>${maven-copy-rename-maven-plugin.version}</version>
<executions>
<execution>
<id>copy-gitlab-ci-library-file</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>ch.fortysix</groupId>
<artifactId>maven-postman-plugin</artifactId>
<configuration>
<skip>false</skip>
<from>[email protected]</from>
<mailuser>[email protected]</mailuser>
<mailpassword>test</mailpassword>
<failonerror>true</failonerror>
<mailport>465</mailport>
<mailhost>smtp.gmail.com</mailhost>
<receivers>
<receiver>[email protected]</receiver>
</receivers>
</configuration>
<executions>
<execution>
<id>send surefire notification</id>
<phase>site</phase>
<goals>
<goal>surefire-mail</goal>
</goals>
<configuration>
<from>[email protected]</from>
<subject>Test Surefire</subject>
<groovyCondition><![CDATA[failures > 0]]></groovyCondition>
<receivers>
<receiver>[email protected]</receiver>
</receivers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我尝试了此处描述的配置:https://doc.fortysix.ch/maven/maven-postman-plugin/maven-pdf-plugin.pdf
有人解决了这个问题吗我也被困在这个问题