如果 jboss 版本是 4.2,maven-ear-plugin 可以工作,但如果是 5,则不行。为什么?

发布于 2024-08-26 14:51:25 字数 4065 浏览 9 评论 0原文

我正在使用 maven 来配置 maven-ear-plugin。当我说 jboss 版本是 5 时,我收到以下异常(请参阅下面的代码,在标签下)。如果我将版本替换为 4.2,它就可以工作。

<build>
    <finalName>tactical</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <version>5</version>
                <defaultJavaBundleDir>lib</defaultJavaBundleDir>
                <jboss>
                    <version>5</version>
                    <loader-repository>seam.jboss.org:loader=tactical</loader-repository>
                </jboss>
 <modules>
                    <ejbModule>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>tactical-jar</artifactId>
                    </ejbModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

为什么它在 jboss 4.2 上工作正常,但在 5 上却不行。什么?

我得到以下异常:

    [INFO] Failed to initialize JBoss configuration

Embedded error: Invalid JBoss configuration, version[5] is not supported.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to initialize JBoss configuration
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:49
9)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav
a:330)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to initialize JBoss configuration
        at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:159)
        at org.apache.maven.plugin.ear.GenerateApplicationXmlMojo.execute(GenerateApplicationXmlMojo.java:96)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        ... 16 more
Caused by: org.apache.maven.plugin.ear.EarPluginException: Invalid JBoss configuration, version[5] is not supported.
        at org.apache.maven.plugin.ear.JbossConfiguration.<init>(JbossConfiguration.java:95)
        at org.apache.maven.plugin.ear.AbstractEarMojo.initializeJbossConfiguration(AbstractEarMojo.java:296)
        at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:155)
        ... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds

任何想法。 谢谢

I am using maven to configure maven-ear-plugin. I am getting following exception when I say jboss version is 5 (See below code, under tag). It works if I replace version to 4.2

<build>
    <finalName>tactical</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <configuration>
                <version>5</version>
                <defaultJavaBundleDir>lib</defaultJavaBundleDir>
                <jboss>
                    <version>5</version>
                    <loader-repository>seam.jboss.org:loader=tactical</loader-repository>
                </jboss>
 <modules>
                    <ejbModule>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>tactical-jar</artifactId>
                    </ejbModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

Why it works fine for jboss 4.2 but not for 5. What ??

I get the following exception:

    [INFO] Failed to initialize JBoss configuration

Embedded error: Invalid JBoss configuration, version[5] is not supported.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to initialize JBoss configuration
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:49
9)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav
a:330)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to initialize JBoss configuration
        at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:159)
        at org.apache.maven.plugin.ear.GenerateApplicationXmlMojo.execute(GenerateApplicationXmlMojo.java:96)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
        ... 16 more
Caused by: org.apache.maven.plugin.ear.EarPluginException: Invalid JBoss configuration, version[5] is not supported.
        at org.apache.maven.plugin.ear.JbossConfiguration.<init>(JbossConfiguration.java:95)
        at org.apache.maven.plugin.ear.AbstractEarMojo.initializeJbossConfiguration(AbstractEarMojo.java:296)
        at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:155)
        ... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds

Any idea.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

私野 2024-09-02 14:51:25

您使用的是哪个版本的插件?最新源代码 表明这应该有效。

120             else if ( version.equals( JbossConfiguration.VERSION_5 ) )
121             {
122                 this.jbossFive = true;
123             }
124             else
125             {
126                 throw new EarPluginException(
127                     "Invalid JBoss configuration, version[" + version + "] is not supported." );
128             }

Which version of the plugin are you using ? The latest source code suggests this should work.

120             else if ( version.equals( JbossConfiguration.VERSION_5 ) )
121             {
122                 this.jbossFive = true;
123             }
124             else
125             {
126                 throw new EarPluginException(
127                     "Invalid JBoss configuration, version[" + version + "] is not supported." );
128             }
ゝ偶尔ゞ 2024-09-02 14:51:25

maven Ear 插件 2.3.2 及更高版本中提供了对 JBoss 5 的支持(请参阅 MEAR -102)。使用您当前的配置(不指定插件的版本,为了构建可重复性,不建议这样做),您将获得该插件的版本 2.3.1。您可以通过运行打印“有效的 pom”来检查这一点:

mvn help:effective-pom

在您的情况下,我建议使用最新版本:

<build>
  <finalName>tactical</finalName>
  <plugins>
    <plugin>
      <artifactId>maven-ear-plugin</artifactId>
      <!-- Lock down plugin version for build reproducibility -->
      <version>2.4.1</version>
      <configuration>
        <version>5</version>
        <defaultJavaBundleDir>lib</defaultJavaBundleDir>
        <jboss>
          <version>5</version>
          <loader-repository>seam.jboss.org:loader=tactical</loader-repository>
        </jboss>
        <modules>
          <ejbModule>
            <groupId>${project.groupId}</groupId>
            <artifactId>tactical-jar</artifactId>
          </ejbModule>
        </modules>
      </configuration>
    </plugin>
  </plugins>
</build>

The support of JBoss 5 is available in version 2.3.2 and later of the maven ear plugin (see MEAR-102). With your current configuration (without specifying the version of the plugin, which is not recommended for the sake of build reproducibility), you get the version 2.3.1 of the plugin. You can print the "effective pom" to check this by running:

mvn help:effective-pom

In your case, I suggest to use the latest version:

<build>
  <finalName>tactical</finalName>
  <plugins>
    <plugin>
      <artifactId>maven-ear-plugin</artifactId>
      <!-- Lock down plugin version for build reproducibility -->
      <version>2.4.1</version>
      <configuration>
        <version>5</version>
        <defaultJavaBundleDir>lib</defaultJavaBundleDir>
        <jboss>
          <version>5</version>
          <loader-repository>seam.jboss.org:loader=tactical</loader-repository>
        </jboss>
        <modules>
          <ejbModule>
            <groupId>${project.groupId}</groupId>
            <artifactId>tactical-jar</artifactId>
          </ejbModule>
        </modules>
      </configuration>
    </plugin>
  </plugins>
</build>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文