0

我们有一个正在运行(在 Karaf 中)并使用 JDK 8 构建的微服务项目。
现在我正在尝试使用 JDK 11(实际上是 OpenJDK)构建它,但我收到了这个错误。

这是否意味着这个插件与 JDK 11 不兼容?

还是有别的意思?

在插件的官方页面上,如果插件与 JDK 11 兼容,我看不到任何信息。插件的最新版本似乎是 1.10.0,这就是我正在尝试使用的版本(但那是 2018 年的最后一次构建,所以它被其他东西取代了吗?)。

    [ERROR] Failed to execute goal org.apache.aries.blueprint:blueprint-maven-plugin:1.10.0:blueprint-generate (default) on project microservices: Error during blueprint generation: IllegalArgumentException -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.aries.blueprint:blueprint-maven-plugin:1.10.0:blueprint-generate (default) on project microservices: Error during blueprint generation
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
            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:116)
            at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
            at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.base/java.lang.reflect.Method.invoke(Method.java:566)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.apache.maven.plugin.MojoExecutionException: Error during blueprint generation
            at org.apache.aries.blueprint.plugin.GenerateMojo.execute(GenerateMojo.java:149)
            at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
            at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
            ... 20 more
    Caused by: java.lang.IllegalArgumentException
            at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
            at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
            at org.apache.xbean.asm5.ClassReader.<init>(Unknown Source)
            at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:580)
            at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:576)
            at org.apache.xbean.finder.AbstractFinder.readClassDef(AbstractFinder.java:562)
            at org.apache.xbean.finder.ClassFinder.<init>(ClassFinder.java:122)
            at org.apache.aries.blueprint.plugin.GenerateMojo.createProjectScopeFinder(GenerateMojo.java:220)
            at org.apache.aries.blueprint.plugin.GenerateMojo.generateBlueprint(GenerateMojo.java:155)
            at org.apache.aries.blueprint.plugin.GenerateMojo.execute(GenerateMojo.java:145)
            ... 22 more
    [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
    

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
4

1 回答 1

2

在将 karaf 部署的项目从 jdk8 迁移到 jdk11 时,我刚刚遇到了几个与 blueprint-maven-plugin 类似的问题。由于 blueprint-maven-plugin 自 2018 年 5 月以来仍处于 1.10.0 版本,因此在这些问题中进​​行了讨论

我有一个解决方法,将 org.apache.xbean:xbean-finder-shaded 的版本覆盖到 blueprint-maven-plugin 的最新版本:

<pluginManagement>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.aries.blueprint</groupId>
            <artifactId>blueprint-maven-plugin</artifactId>
            <version>1.10.0</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.xbean</groupId>
                    <artifactId>xbean-finder-shaded</artifactId>
                    <version>4.20</version>
                </dependency>
            </dependencies>
        </plugin>
于 2021-08-17T10:43:04.737 回答